Skip to content
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

Closed
axic opened this issue Jul 18, 2016 · 4 comments
Closed

Macros #92

axic opened this issue Jul 18, 2016 · 4 comments

Comments

@axic
Copy link
Contributor

axic commented Jul 18, 2016

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 turn wasm back to its original form with macros.

@binji
Copy link
Member

binji commented Jul 18, 2016

@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.

@axic
Copy link
Contributor Author

axic commented Jul 21, 2016

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 sexpr-wasm or they are out of scope because they're not stored in WASM?

@binji
Copy link
Member

binji commented Jul 21, 2016

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.

@ghost
Copy link

ghost commented Jan 14, 2017

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.

@keithw keithw closed this as completed May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants