On 09.06.2011 1:30, Alex_Dovhal wrote:
"Dmitry Olshansky"<dmitry.o...@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?
Isn't this a main point of UFCS to have member syntax x.method(...) be substitute for method(x,...) ? :)
Well, and to me having some freedom in position of this argument seems OK.
And which argument to it is one before dot?
obviously, the one author of cycle, stride, take etc. meant to be. Most likely the first ? ;) Clearly there is a potential to abuse, but you can abuse a whole lot of other features.
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)

Generally they are known to reader - they are free functions (and even small subset of those) anyway, not some scary monsters from hell. And you'd have to strain your mind and memory to check docs anyway.
And of course bad pick of position for this argument is clearly possible.
It's good thing that it remains in control of library writer, not user. Thus combinations stay limited, as careful library writer is usually expected thing, as for user it's not exactly.

--
Dmitry Olshansky

Reply via email to