Skip to content

Instantly share code, notes, and snippets.

@marijnh
Created June 7, 2011 09:28
Show Gist options
  • Save marijnh/1011949 to your computer and use it in GitHub Desktop.
Save marijnh/1011949 to your computer and use it in GitHub Desktop.
tag a {
left(int);
right(bool);
}
fn sabotage(@rec(mutable a foo) x) {
x.foo = left(0);
}
fn main() {
auto v = @rec(mutable foo = right(true));
auto sabot = bind sabotage(v);
alt (v.foo) {
case (right(?u)) {
sabot(1);
log_err u;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment