UFCS idea

Alex_Dovhal alex_dovhal at yahoo.com
Wed Jun 8 14:30:53 PDT 2011


"Dmitry Olshansky" <dmitry.olsh at gmail.com> wrote
> what was so bad about having 'this' inside parameters?
> I thought it was rather compelling:
>
> void func(Type1 this, Type2 p2);
> which is legal only as a free function and inside structs/classes it's 
> declaration syntax error.
>
> [3,2,5,3].cycle.stride(2).take(10); //and no snails :)
>
>
>
> -- 
> Dmitry Olshansky
>

UFCS with 'this' is not bad. I've just got another competitive idea which 
i'd like to discuss.

>[3,2,5,3].cycle.stride(2).take(10); //and no snails :)
Yes, but can you tell what is stride(2) or take(10) - member function of 
UFCS?
And which argument to it is one before dot?
Sure here you can, but in more complex cases or when you don't want to 
strain you mind and memory.
a.someUnknownToReaderFunc(b).otherNotOftenUsedFunc(c) 




More information about the Digitalmars-d mailing list