What's possible with `let` and `const` macros
Opened this issue · 2 comments
Raynos commented
I know there's a compiler for it ( https://github.com/olov/defs ) but it would be cool to have it as a macro as well.
jlongster commented
So sweet.js already is aware of the scopes of everything, and it handles let/const scoping properly. It even already renames all the variables because of the hygiene system. It's probably easiest to just add a flag to sweet.js to tell it to compile out everything to var
statements instead of keeping the original type. Otherwise you'd have to do some pretty extensive expansion to imitate the let/const
behavior.
Raynos commented
This is more about parsing ES5 with a macro for let/const then parsing ES6 with real let/const.