Consider these snippets:
vim9script 123
E1050: Colon required before a range: 123
vim9script eval 123
E1207: Expression without an effect: 123
Should the first one give E1207
just like the second one?
Consider these 2 other snippets:
vim9script 'string'
no error
vim9script eval 'string'
no error
To be consistent with the previous ones, shouldn't they give this error:
E1207: Expression without an effect: 'string'
Finally, consider these 2 snippets:
vim9script var n = 123 $'{n}'->setline(1)
E1050: Colon required before a range: $'{n}'
vim9script def Func() var n = 123 $'{n}'->setline(1) enddef Func()
E476: Invalid command: $'{n}'
First, the errors are different between the script level and the body a :def
function. Should they be made the same?
Second, could we recognize $
as the start of an interpolated string when followed by a quote? It would be more consistent with how non-interpolated strings can be used at the start of a line and followed by a method call:
vim9script '123'->setline(1)
123
vim9script def Func() '123'->setline(1) enddef Func()
123
Note that as a workaround, we can use parens:
vim9script var n = 123 ($'{n}')->setline(1)
123
vim9script def Func() var n = 123 ($'{n}')->setline(1) enddef Func()
123
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.