Pattern matching for sealed enums
Previously if you wanted to check sealed enums types and use them, you had to do very ugly syntax for actually getting the variant instance:
auto out = tryGet();
when(out) {
Result.Success -> {
auto suc = out as Result.Success;
looks::say("Success! ${suc.out.x}");
Now you don’t have to do all of this:
when(tryGet()) {
Result.Success suc -> {
looks::say("Success! ${suc.out.x}");
This is just syntax improvement, doesn’t change the generated code or anything, just helps the developer
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.