Pattern matching in D

BCS none at anon.com
Sun Mar 7 15:48:22 PST 2010


Hello Walter,

> retard wrote:
> 
>> Sun, 07 Mar 2010 11:17:46 -0800, Walter Bright wrote:
>> 
>>> retard wrote:
>>> 
>>>> - Pattern matching (extension to enum/string/integer accepting
>>>> switch)
>>>> 
>>> Andrei and Sean have shown how to do that nicely with existing
>>> language features.
>>> 
>> Really? I'd really like to see how this is done.
>> 
> foo is a variadic template which takes its first argument, v, and
> attempts to match it with each delegate in turn. The first one that
> matches is executed.
> 
> The matching is all done at compile time, of course, and the delegate
> can be inlined.


I think (from context in other strands) that the OP was referring to value, 
not type, pattern matching.

> 
-- 
... <IXOYE><






More information about the Digitalmars-d mailing list