Skip to content

bool patternmatching #105

Description

@crazymonkyyy

Full pattern matching is likely very hard and slow too implement while switch statements are just an asm trick

There's something in between, where you preprocess several if statements in concatenated bools, then you reuse the asm trick on the resulting recomputed ints

https://forum.dlang.org/thread/fsjfcairmfcdwraxabdk@forum.dlang.org

switch(i%3==0,i%5==0){
  case 1,1: return "fizzbuzz";
  case 0,1: return "buzz";
  case 1,0: return "fizz";
  case ?,?: return i.to!string;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions