Uniform call syntax for implicit this.
Michel Fortin
michel.fortin at michelf.com
Thu Feb 3 09:54:44 PST 2011
On 2011-02-03 12:43:12 -0500, Daniel Gibson <metalcaedes at gmail.com> said:
> Am 03.02.2011 15:57, schrieb Michel Fortin:
>> On 2011-02-02 23:48:15 -0500, %u <dflgkd at sgjds.com> said:
>>
>>> When implemented, will uniform call syntax work for the "this"
>>> object even if not specified?
>>>
>>> For example, will foo() get called in the following example?
>>>
>>> void foo(A a, int b) {}
>>>
>>> class A {
>>> void test() {
>>> this.foo(10);
>>> foo(10);
>>> }
>>> }
>>
>> I think it should work.
>
> I think foo(10) should *not* be equivalent to foo(this, 10).
Personally, I'm not sure whether the uniform call syntax will be this
much useful or not, but if it gets implemented I think foo(10) should
be equivalent to foo(this, 10) in the case above. That said, it should
not be ambiguous: if there is a member function foo and a global
function foo and both matches the call, it's ambiguous and it should be
an error.
Can this work in practice? We probably won't know until we have an
implementation to play with.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list