Last active
December 20, 2015 14:19
-
-
Save huonw/6145412 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
match 'foo { | |
'foo => { | |
if some_thing { | |
match 'bar; | |
} else if other_thing { | |
match 'baz; | |
} | |
} | |
'bar => { blah(); match 'baz; } | |
'baz => { blahblah(); match 'foo; } | |
} |
This file contains hidden or 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
match 'foo { | |
'foo => { | |
match if some_thing { | |
'bar | |
} else if other_thing { | |
'baz | |
} else { | |
'end | |
} | |
} | |
'bar => { blah(); match 'baz; } | |
'baz => { blahblah(); match 'foo; } | |
'end => {} | |
} |
This file contains hidden or 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
enum Matcher { Foo, Bar(int), Baz(float) } | |
match xyz { | |
Foo => { | |
if some_thing { | |
match Bar(10); | |
} else if other_thing { | |
match Baz(10000.0); | |
} | |
} | |
Bar(n) => { blah(n); match Baz(1.2); } | |
Baz(f) => { blahblah(f); match Foo; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A basic sketch of what this might look like when used for a yield state machine compiler. (Probably unworkable... it somehow has to handle the
loop
properly.)