To help LDC/GDC

Timon Gehr timon.gehr at gmx.ch
Thu Apr 11 11:24:54 PDT 2013


On 04/11/2013 07:48 AM, Walter Bright wrote:
> On 4/10/2013 10:44 PM, Timon Gehr wrote:
>> On 04/10/2013 11:50 PM, Walter Bright wrote:
>>> ...
>>>
>>> My point was that competing designs are very probably not necessary. We
>>> just need to pull on the string on what must be.
>>>
>>
>> Yes, IMO it is quite obvious how to do it. (transfer the meaning of the
>> modifiers from member functions to local functions, disallow
>> conversion to const
>> for delegates and disallow loading a mutable delegate from a const
>> receiver.)
>> However, I think there are other opinions. There will probably always
>> be as long
>> as nothing is specified as the official behaviour.
>
> A delegate works exactly like a member function call. It has an implicit
> 'this' pointer, and how the 'this' pointer is qualified, just like for a
> member function, determines how it works.

That's still not sufficient as a specification.

A member function may be qualified differently from the 'this' pointer 
and calling said member function may even be disallowed because of this.

For delegates, the same syntax element is used for qualifying the 
context pointer and the function. Therefore delegates and member 
functions need to behave differently.


More information about the Digitalmars-d mailing list