Open ModProg opened 1 year ago
I'm a bit skeptical in locking down a "higher-level" API. Any improvement could essentially be implemented as helper functions without having to commit to some specific signature. But I do welcome exploration into the space.
yeah, this can definitely be seen as a future quality of live thing, and similarly to how manyhow
is a standalone crate for the rust macro system, this could easily be implemented in a simple_rune_macros
crate that exposes a macro for this.
I see a few ways to improve ergonomics of macro implementation.
Parse
andToTokens
implementations the macro api could beFn(impl Parse) -> impl ToTokens
(though not sure what the implications would be for have adyn Fn
to store in the handlers Map. But this could also just be done by therune::macro_
attribute, which would not actually change the handlers. (This is how I implemented https://docs.rs/manyhow/ for rust macros, though I only support the conversion between tokenstreams). IfTokenStream
implements bothParse
andToTokens
than this would still allow the current usage. This would allow using it like so:call_site
concept for errors that will be replaced with the macro-span could be helpful for reducing needing to pass through the spans everywhere. But this might also just unnecessarily complicate things.