Closed christianp closed 10 months ago
what are you trying to achieve with this
The problem is that string literals inside expression()
are each separately compiled before substitution is performed on the syntax tree, and then serialized back to a string.
The reason we can't just concatenate all the strings before subbing is something like expression("(a + " + n + " + c)")
, where n
could be any complicated expression that evaluates to something which can convert to string.
I tried using the forgiving parser to allow a missing right-hand argument for the case at the top of this issue, but I don't think that satisfies enough of the cases to justify introducing more weird behaviour.
This might just have to be something that can't work. We should push people to construct expressions by using substitute
.
Minimal example:
expression("{1}+" + "2")
. I get an error "not enough arguments for operation+
". My guess is that at some point it's trying to compile the first string literal as an entire expression.