You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The README.MD file hints at macros being useful for scaffolding head/body items …
It may be useful to define macros that expand to either body items or head items. Ascent allows you to do this.
… which the MACROS.MD then provides further examples for and gives the following motivation …
Macros can be defined inside Ascent programs to avoid having to repeat code.
As somebody accustomed to Rust's native macro the above would make one assume that —just like in Rust itself— ascent's macros could be used in effectively every position in the code. In reality however it seems that ascent's macros are limited to clause position.
As such I would expect the above to either be accepted or at least provide a more useful error message than the current "cannot find macro … in this scope".
The text was updated successfully, but these errors were encountered:
The point of macro definitions in Ascent is to do what can't be done with normal Rust macros (i.e., expand to body or head clauses). If you need macros that expand to expressions (as in your second example), you can just define them as Rust macros.
Regarding better error messages, that's not really feasible, as the error message is coming from the Rust compiler, and not Ascent.
The readme mentions that macro invocations expand to body or head items. I'll update MACROS.MD to emphasize this fact.
The README.MD file hints at macros being useful for scaffolding head/body items …
… which the MACROS.MD then provides further examples for and gives the following motivation …
As somebody accustomed to Rust's native macro the above would make one assume that —just like in Rust itself— ascent's macros could be used in effectively every position in the code. In reality however it seems that ascent's macros are limited to clause position.
As such this works:
This however doesn't:
This is rather surprising and unexpected.
As such I would expect the above to either be accepted or at least provide a more useful error message than the current "cannot find macro
…
in this scope".The text was updated successfully, but these errors were encountered: