-
Notifications
You must be signed in to change notification settings - Fork 719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Macros #92
Comments
@sunfishcode experimented with this some here: WebAssembly/spec#155. It is tedious to write wast files, but they're not meant to be the text format for WebAssembly. Rather, they're convenient as being a direct representation of the module AST, used primarily for writing tests. You may want to take a look at this proposal for the text format: WebAssembly/design#704. It doesn't support macros, but it is not nearly as verbose as the wast format. |
Thanks, I've seen there are more proposals for the text format. I'd like to see WAST (with macros) to survive as a stable format :) We have written some code already in WAST and it is not that bad, unless unrolled loops need to be implemented. Would macros be suitable for |
Yeah, it's definitely a goal to keep the wast format as parsed by sexpr-wasm to be consistent with the wast format as parsed by spec/ml-proto. So adding macros would be out of scope, IMO. That said, it seems to me that you could use a preprocessor to do what you want. Seems like it should be pretty straightforward if you just grab a lisp/scheme and use that to do it. |
Macros would be a very very useful thing to have in webassembly because you could spin up your own web language from within the assembly. For projects which absolutely must be as close to the bare metal as possible but need to be on the web this would speed up development. |
Are there any plans to introduce support for macros? Something similar to Lisp's
defmacro
perhaps, with both the'
and~
modifiers.It would make life a bit easier writing
wast
. It won't be of course (easily) possible to turnwasm
back to its original form with macros.The text was updated successfully, but these errors were encountered: