Reference counted containers prototype

deadalnix deadalnix at gmail.com
Tue Dec 27 03:54:44 PST 2011


Le 27/12/2011 08:00, Robert Jacques a écrit :
> On Mon, 26 Dec 2011 17:30:54 -0800, Peter Alexander
> <peter.alexander.au at gmail.com> wrote:
>
>> On 27/12/11 1:14 AM, Robert Jacques wrote:
>>> On Mon, 26 Dec 2011 17:09:02 -0800, Peter Alexander
>>>> If the held object has a method with the same name as RefCounted (e.g.
>>>> asConst) then how do you call the held object's method instead of
>>>> RefCounted's method?
>>>
>>> You, can't. Looking at the source code asConst is a private member
>>> function and therefore, given we are using opDispatch for forwarding,
>>> these methods should have _ or __ prepended onto them.
>>
>> Identifiers starting with __ are reserved, which leaves you with _,
>> which could be used by the held object also.
>
> Yes, in theory, but no in practice. It's perfectly possible to use
> __name or __name__ in user code, just highly not recommended. And while
> I'd never do that in my user code, I think the runtime and the standard
> library should be able to use __ (or maybe ___) when needed.

+1

It is reasonable that standard lib and compiler could agree on keywords 
they use.


More information about the Digitalmars-d mailing list