Skip to content

Instantly share code, notes, and snippets.

@disnet
Created September 27, 2013 21:47
Show Gist options
  • Save disnet/6735679 to your computer and use it in GitHub Desktop.
Save disnet/6735679 to your computer and use it in GitHub Desktop.
hygiene
var random = function(seed) { /* ... */ }
let m = macro {
rule {()} => {
var n = random(42); // ...
}
}
@getify
Copy link

getify commented Oct 1, 2013

In fact, instead of renaming macro-declared variables to prevent overlap, you could just wrap (while expanding) the body of the macro code in a stand-alone { .. } block and change vars to lets, and that would create hygiene (aka, prevent any inner-to-outer leakage) in the same way as renaming, but with way less work.

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