Reference counted containers prototype

Robert Jacques sandford at jhu.edu
Mon Dec 26 23:16:21 PST 2011


On Mon, 26 Dec 2011 19:00:57 -0800, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:

> On 12/26/11 7:49 PM, Andrej Mitrovic wrote:
>> On 12/27/11, Andrei Alexandrescu<SeeWebsiteForEmail at erdani.org>  wrote:
>>> We can easily have opDispatch look at field names. But I think it's poor
>>> design to expose bald data anyway.
>>
>> opDispatch doesn't work with property functions,
>
> It actually does, as per the unittests. Even if it currently does by
> @property being too lax, it should continue to work.

Currently, if opDispatch is only templated on a string, property assignment (i.e. foo.x = 1) syntax works. If opDispatch is templated on more than the method name, DMD 2.057 ICEes.

>> or opBinary,
>
> Should work, as operators are just translated to regular methods.
>
>> or
>> opOpAssign.
>
> Should work.

But not in practice yet; DMD still treats opBinary, opAssign, etc as being special and doesn't forward them to opDispatch. However, it's straightforward to manually define them yourself.


More information about the Digitalmars-d mailing list