equivariant functions

Bruno Medeiros brunodomedeiros+spam at com.gmail
Sat Oct 18 11:51:35 PDT 2008


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?

-- 
Bruno Medeiros - Software Developer, MSc. in CS/E graduate
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list