Re:Google Releases JavaScript.next to JavaScript Compiler Tr...
by munificent on Wednesday May 04, 2011 @03:24AM
(#2513048)
I'm on the Traceur team, but I don't speak for all of us (or Google). Personally, I think macros would be really cool, but they're a challenge in a language that isn't homoiconic, has both statements and expressions, and a pretty complex grammar. I don't know if it would be possible to design a general purpose macro system within those limitations that was usable by mere mortals.
I see macros as being useful for two things: 1) DSL-type "make my own inner language" stuff, and 2) conditional evaluation. JS is already pretty syntactically flexible, especially with object literals, so that covers some of (1). JS already has closures, so if we can get a nicer function literal syntax, that makes it tolerable to do (2) just by passing functions around (and it's more explicit, which is good to some people).
I see macros as being useful for two things: 1) DSL-type "make my own inner language" stuff, and 2) conditional evaluation. JS is already pretty syntactically flexible, especially with object literals, so that covers some of (1). JS already has closures, so if we can get a nicer function literal syntax, that makes it tolerable to do (2) just by passing functions around (and it's more explicit, which is good to some people).