Pattern matching in D?

Chris M via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 23 12:38:19 PDT 2016


On Friday, 21 October 2016 at 19:00:55 UTC, Nick Sabalausky wrote:
> On 10/20/2016 10:16 PM, Chris M. wrote:
>> So I know you can do some pattern matching with templates in 
>> D, but has
>> there been any discussion about implementing it as a language 
>> feature,
>> maybe something similar to Rust's match keyword
>> (https://doc.rust-lang.org/stable/book/patterns.html)? What 
>> would your
>> guys' thoughts be?
>>
>
> What I've been really wanting for a long time is the one-two 
> combo of Nemerle's variants and pattern matching:
>
> https://github.com/rsdn/nemerle/wiki/Grok-Variants-and-matching

There is std.variant, though I haven't used it much myself and 
don't know how well it compares. Seems like that library would 
provide a good basis for providing pattern matching though.


More information about the Digitalmars-d mailing list