Skip to content

Instantly share code, notes, and snippets.

@apaleslimghost
Created October 20, 2014 14:11
Show Gist options
  • Save apaleslimghost/60a3772e2224ad0384a2 to your computer and use it in GitHub Desktop.
Save apaleslimghost/60a3772e2224ad0384a2 to your computer and use it in GitHub Desktop.
Sweet.js bound access macro
macro (~) {
rule infix { $l:expr | $r:ident } => { (ref = $l, ref.$r.bind(ref)) }
rule infix { $l:expr | $r:expr } => { (ref = $l, ref[$r].bind(ref)) }
}
var c = a~b;
a({
b: c~(foo)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment