Skip to content

Instantly share code, notes, and snippets.

@disnet
Created October 16, 2012 21:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save disnet/3902112 to your computer and use it in GitHub Desktop.
Save disnet/3902112 to your computer and use it in GitHub Desktop.
parameter annotations (type, contract, etc.) in sweet.js
macro def {
case $name:ident ( $($params:ident : $type:ident) (,) ...) $body => {
// just throwing away the type annotation. The semantics of type
// annotations left as an exercise to the reader :)
function $name ($params (,) ...) $body
}
}
def add (a : Number, b : Number) {
return a + b;
}
add(1,2)
@carlsmith
Copy link

It'd be nice if this could be used to write pretty asm.

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