Dmitry Olshansky wrote:
> On 09.06.2011 1:55, Timon Gehr wrote:
>> Alex Dovhal wrote:
>>> Yes, but imagine you have a situation:
>>> someLib.d:
>>> class A{
>>>      void member1(int a);
>>>      void member2(int a);
>>>      ...
>>> }
>>>
>>> someUserCode.d:
>>> void member3(A this, int a); //local user func
>>> ...
>>> member3(x, 1); //hundred times in user code
>>>
>>> And later library writer adds void member3(int a) member to class A.
>>> Now user code has name collision.
>> No, his 100 calls are all unambiguous.
>>
> That, if we do rewrite in one direction only:
> e.g. x.member3(1) --> member3(x, 1);
> but it would be an unpleasant surprise in this case, suppose his 101th
> call looked like:
> x.member3(1)
> then after change it suddenly stops calling his code, and calls library
> code. And silently!

No. _That_ code would blow up during compilation because it is an ambiguous 
call.
It's iust like the rest of D.

> So I think UFCS should work in both directions.

I don't. I do not see any use case for the other direction. (and it would be
really screwy anyways) Use UFCS if you want both to be valid.


Timon

Reply via email to