equivariant functions

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Oct 18 11:59:38 PDT 2008


Bruno Medeiros wrote:
> Andrei Alexandrescu wrote:
>>
>> What I'm saying is that we're really trying to beat the compiler in 
>> the head until it understands that:
>>
>> S stripl(S s) if (is(S : const(char)[]) { stmts }
>>
>> really means to us:
>>
>> char[] stripl(char[] s) { stmts }
>> const(char)[] stripl(const(char)[] s) { stmts }
>> invariant(char)[] stripl(invariant(char) s) if (is(S : const(char)[]) 
>> { stmts }
>>
>> What if, instead of finding yet another notation for that simple fact, 
>> we actually used the "right" notation (it is right because it's 
>> already there!) and figure out whether the compiler can understand it?
>>
>> I was about to post when I realized that that idea won't work prettily 
>> at all with member functions... sigh :o/
>>
>>
>> Andrei
> 
> Wouldn't work prettily with member functions because one can't 
> parameterize on the actual 'this' argument, right?

Yah, one can't do that unless more notation is added...

Andrei



More information about the Digitalmars-d mailing list