Go and generic programming on reddit, also touches on D

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Sep 18 13:32:44 PDT 2011


On 9/18/11 3:19 PM, dsimcha wrote:
> On 9/18/2011 4:09 PM, Andrei Alexandrescu wrote:
>> opDollar is more powerful because it can be made to work with infinite
>> ranges.
>>
>> Andrei
>
> Yes, this is important. IMHO, though, the default behavior of the $
> operator should be to call range.length if it exists and opDollar isn't
> explicitly overloaded. This would save a lot of boilerplate.

struct MyRange
{
   ...
   alias length opDollar;
}

I do agree that most of the time this is what you want anyway, so that 
line would occur a lot of times...


Andrei


More information about the Digitalmars-d mailing list