First class functions is the concept where functions can be data/stored in variables and treated the exact same was as data
We have problems:
Commands are fundamentally different from variables
Commands that take 0 arguments (arity 0) are still actions that can have side effects when run
With first class functions, a variable should behave like a 0-arity function
By design function calls do not have brackets/tupling of arguments
Hence
command is a command call with no arguments
$command refers to a variable called command, no action taken
the $ is needed to make the distinction
If a variable stores a lambda we cannot use the same syntax because
$command is ambiguous - Do we want to execute it? or just refer to the action itself
First class functions is the concept where functions can be data/stored in variables and treated the exact same was as data
We have problems:
Commands are fundamentally different from variables Commands that take 0 arguments (arity 0) are still actions that can have side effects when run With first class functions, a variable should behave like a 0-arity function
By design function calls do not have brackets/tupling of arguments
Hence
command
is a command call with no arguments$command
refers to a variable called command, no action taken the$
is needed to make the distinctionIf a variable stores a lambda we cannot use the same syntax because
$command
is ambiguous - Do we want to execute it? or just refer to the action itself