As part of #138, I changed command argument interpolation to use the same rules as string interpolation.
Variable interpolation in commands used to choose between expanding to a single argument or multiple arguments based on the variable's type:
(\x -> `echo $x`) : ToArgs a=> a -> Cmd
Interpolating an Array String would expand to multiple arguments:
let x = ["a", "b"] in
`echo $x`
~>
`echo a b`
Since #138, you can't interpolate variables of type Array String into commands. Only Strings:
(\x -> `echo $x`) : String -> Cmd
I mostly did this by accident; my intent was to simplify the implementation of command syntax. I then realised that the explicitness of the approach could be helpful.
Should the result of
let x = ["a", "b"] in
`echo $x`
be
`echo a b`
or
`echo "a b"`
or
`echo "[\"a\", \"b\"]"`
or something else?
Some of the options are more sensible than others, but the fact that I can ask the question also seems like a problem in itself.
When Array String can be substituted using $,
`echo $x`
and
`echo "$x"`
can mean different things. If x : Array String, then adding the double quotes changes the meaning of the command. I think it would be good if adding double quotes like this was always redundant, rather than "only being redundant when x : String". Substituting String and Array String with $ reminds me a bit too much of current shells, in which shellcheck recommends always quoting substitutions to avoid weirdness. ipso doesn't have that weirdness, but I think it'll be nice to move in the other direction.
As part of #138, I changed command argument interpolation to use the same rules as string interpolation.
Variable interpolation in commands used to choose between expanding to a single argument or multiple arguments based on the variable's type:
Interpolating an
Array String
would expand to multiple arguments:Since #138, you can't interpolate variables of type
Array String
into commands. OnlyString
s:I mostly did this by accident; my intent was to simplify the implementation of command syntax. I then realised that the explicitness of the approach could be helpful.
Should the result of
be
or
or
or something else?
Some of the options are more sensible than others, but the fact that I can ask the question also seems like a problem in itself.
When
Array String
can be substituted using$
,and
can mean different things. If
x : Array String
, then adding the double quotes changes the meaning of the command. I think it would be good if adding double quotes like this was always redundant, rather than "only being redundant whenx : String
". SubstitutingString
andArray String
with$
reminds me a bit too much of current shells, in which shellcheck recommends always quoting substitutions to avoid weirdness.ipso
doesn't have that weirdness, but I think it'll be nice to move in the other direction.