Is D a cult?

BCS none at anon.com
Sun Mar 7 14:43:01 PST 2010


Hello retard,

> Sun, 07 Mar 2010 11:17:46 -0800, Walter Bright wrote:
> 
>> retard wrote:
>> 
>>> Let's see what features I had in mind:
>>> 
>>> - Algrebraic data types
>>> 
>> std.variant covers this.
>> 
>>> - 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. Especially the nested
> matching of algebraic constructs, e.g.
> 
> my_list match {
> case 1 :: 2 :: 3 :: tail => 123 :: tail
> }
> in D:
> 
> if (list.getElemAt(0) == 1 &&
> list.getElemAt(1) == 2 &&
> list.getElemAt(2) == 3) {
> return list.new(123).append(list.range(3, list.length));
> }


I'd rather the following over either:

if(list[0..3] == [1,2,3]) return new list(123, list[3..$]);


> The -> and => symbols are not used in
> D so I suppose it wouldn't be a big problem to extend the syntax with
> an expression returning lambda. After all, everything else is already
> there.

While I'm not for it, how much harm would adding yet another form of the 
delegate expression cause?

-- 
... <IXOYE><






More information about the Digitalmars-d mailing list