D is the best tool for this!!! How do we tell them??

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Aug 6 02:24:00 UTC 2024


On 06/08/2024 1:24 PM, Walter Bright wrote:
> On 8/4/2024 3:06 AM, Guillaume Piolat wrote:
>> - Some C headers like j40.h and miniz.h use the "switch-based 
>> coroutine" and exploit the fact the case label can be anywhere to 
>> create push parsers. Rust match doesn't allow labels anywhere, but D 
>> does so you can do the switch-based coroutine. Example: 
>> https://gist.github.com/mrtrizer/a14c033a054c191d9d23bfa516ad8107
>> At least this case is easy in D.
> 
> It's one reason why pattern matching in D will be a construct separate 
> from the switch statement.

At the language level yes.

At the implementation level the proposed solution is to deconstruct it 
into switch statements as they are already optimized.

https://github.com/dlang/DIPs/pull/246/files#diff-5a287e7c096a0fb05f624ef7304d83cdc53adedafbd8af28d35d82f9dd97cb69R71

Kinda waiting on Mike atm (I know he's busy so not pinging currently).


More information about the Digitalmars-d mailing list