Skip to content

Instantly share code, notes, and snippets.

@fabriceleal
Created November 15, 2012 21:40
Show Gist options
  • Save fabriceleal/4081498 to your computer and use it in GitHub Desktop.
Save fabriceleal/4081498 to your computer and use it in GitHub Desktop.
js let macro
macro $let {
case ( $($id:ident = $val:expr) (,) ... ) $body => {
/*(function(){
$(var $id = $val;) ...
var ____r = (function() $body)();
return ____r;
})()*/
(function ($id (,) ...) $body)($val (,) ...)
}
}
var v = $let(a='hello',b='world') {
return a + b;
};
console.log(v);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment