-
Notifications
You must be signed in to change notification settings - Fork 234
Open
Description
The docs say:
Macros are expanded at compile time and inserted in places they are used
Now consider this grammar:
id[el] -> $el {% id %}
plain_test -> word {% id %}
macro_test -> id[word] {% id %}
word -> [\w]:+ {% d => d[0].join("") %}Given above documentation and grammar I would have expected that macro_test would behave exactly like plain_test . Unfortunately the results differ:
plain_test('asd') ~> 'asd'
macro_test('asd') ~> ['asd']
My current workaround is to manually unwrap the argument expansions in all my macros, like so:
id[el] -> $el {% d => d[0][0] %}However, this is far from ideal.
I'm not sure if this is a code or documentation bug. But I would definitely prefer if macros would not cause this additional wrapping. It gets especially annoying if you have nested macro application.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels