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

Support for hygienic macros #2598

Closed
devinus opened this issue Oct 26, 2012 · 9 comments
Closed

Support for hygienic macros #2598

devinus opened this issue Oct 26, 2012 · 9 comments

Comments

@devinus
Copy link

devinus commented Oct 26, 2012

Lately I've been working with Elixir, a language built on it's support for hygienic macros and it's so far been blowing my mind.

Hygienic macros are an old and extremely powerful concept gaining renewed attention. Wanting to use hygienic macros to make "code that writes code," my first thought was CoffeeScript given it's powerful compiler architecture.

@jashkenas has asked me to open this ticket, I assume for posterity.

@raganwald
Copy link
Contributor

I like Hygienic Macros, I would like to see a some examples of how it would work. Focus on the "back-end:" What would the generated JS look like? Given CS's philosophy of being "just javascript," I think that's the most important part for acceptance.

@devinus
Copy link
Author

devinus commented Oct 31, 2012

@raganwald well being as they're only compile time, there would only be some var rewriting which CS already does. E.g. _v0, _v1, _v2 etc. Other than that the code would look like any other JS code generated from CS.

@michaelficarra
Copy link
Collaborator

@devinus: This compiler doesn't do a proper gensym. Symbol generation avoids other generated symbols, but not user-defind symbols, making it almost useless. See #2459, #2125, #1574, and others. A proper gensym would certainly be a prerequisite to hygienic macros (hence "hygienic"), and I don't see that ever happening without a complete rewrite, CoffeeScriptRedux-style.

@devinus
Copy link
Author

devinus commented Oct 31, 2012

@michaelficarra What ever happened to two-pass variable naming?

@michaelficarra
Copy link
Collaborator

Stuck in #1574, unlikely to ever be completed.

@jashkenas
Copy link
Owner

Hey hey, easy on the fatalism. "Ever" is a very long time ;)

@michaelficarra
Copy link
Collaborator

Sorry, should have qualified with "without a complete rewrite", as in the last comment.

@jashkenas
Copy link
Owner

Fun ticket -- but I'm at a loss as to how to start addressing this without a fuller idea of how the guts of it would actually work. Closing for now.

@crazymykl
Copy link

Hello, Googlers, this is back under active discussion at #3171.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants