Closed Mercerenies closed 1 year ago
Closed by 924afff. We decided to go the route of not introducing more syntax. NodePath
is a function in GDLisp whose call magic is capable of converting to the @"..."
syntax if given a literal string.
The only downside to this is that call magic applies before optimizations, so if an optimization simplifies a NodePath
call into taking a string literal, then it won't get compiled down. We could make an optimization that does the same at a later stage, but I'm not losing much sleep over it.
In GDScript, we can write
@"a/b"
to construct aNodePath
which is pre-parsed. Should we expose this functionality to GDLisp? We could probably use the same exact@
syntax. Currently,@
is only valid in GDLisp followed by a symbol, and it translates toself:
, so it wouldn't conflict with existing usage. Alternatively, we could make@"
start a string literal of a different kind and just have the lexer deal with it.On the other hand, in the spirit of not introducing more syntax, we could make an ordinary function
NodePath
(i.e. very similar to the built-in GDScript one of the same name) and then provide an optimization that can convert it to a string literal if given a literal argument.