www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24585] New: Allow switch with multiple arguments

https://issues.dlang.org/show_bug.cgi?id=24585

          Issue ID: 24585
           Summary: Allow switch with multiple arguments
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: qs.il.paperinik gmail.com

Allow `switch` statements to have more than one argument: `switch (x, y)`.
Case labels then take the same number of arguments: `case (0, 0):`
The parentheses after `case` are then required.

A case label matches if it would match components individually.

While this should work for all types for which `switch` works, if the type of
the components’ sizes adds up to ≤ 64 bit, arguments can be connected into
an
`ulong` (or smaller) and checked together.

--
Jun 04