Closed percyqaz closed 1 year ago
Proposed changes:
command arg1 arg2
interprets everything literally as space separated strings
command $var arg2
interprets 1st argument as the variable var
In general command $(expression in brackets here) $(expression in brackets here)
evaluates those expressions and inserts those as the arguments
You cannot mash up nonsense like command arg_$(stuff)
and to enter a real $ use command $$expr
or command "$expr"
Still need to fix ambiguity
var
calling var with 0 arguments, getting return value
var
referring to var itself, can be passed into other functions
I think maybe @var
can refer to the command itself if var is a command
var
can refer to either a value or executing the command
Ends up being quite a few changes including adding type coercing and stuff but I think nice overall
Bing done except the cmd
vs @cmd
business
since applications need to evaluate just cmd
on its own (which would try to call it with 0 arguments)
Suck it up for now you will just have to call your 0 arity commands manually
I want multi word commands
command sub
But I also want quoteless string arguments
command arg
How can I make these two things unambiguous
The real answer is to use brackets:
command(arg)
andcommand sub(arg)
But I want to maintain the shell stylealso maybe modules should be capitalised and commands be lower case Then
Module.object.prop arg
is acceptable syntaxWhat about some awful hack like an object can be executed as a command if it defines
_c
as a propertyThen multi word commands are
command.sub arg
withcommand arg
still executable