Created
November 15, 2012 21:40
-
-
Save fabriceleal/4081498 to your computer and use it in GitHub Desktop.
js let macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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