Reference counted containers prototype

kenji hara k.hara.pg at gmail.com
Tue Dec 27 03:27:32 PST 2011


I've already posted a dmd patch to fix all of opDispatch problems:

https://github.com/D-Programming-Language/dmd/pull/280

With it, I've posted a useful library utility to implement
'super-type' like D1 typedef:

https://github.com/D-Programming-Language/phobos/pull/300

I'm naming it 'ProxyOf', and it supports various of forwardings,
function call, property access, and specialized template member
function.

Kenji Hara

2011/12/27 Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org>:
> On 12/26/11 7:25 PM, Peter Alexander wrote:
>>
>> Following up to this, how do I access non-function members of the held
>> object? e.g.
>>
>> struct Foo
>> {
>> int x = 1;
>> }
>>
>> void main()
>> {
>> RefCounted!Foo f;
>> writeln(f.x); // Doesn't work
>> }
>
>
> We can easily have opDispatch look at field names. But I think it's poor
> design to expose bald data anyway.
>
>
>> Also, what about template member functions of the held object?
>>
>> struct Foo
>> {
>> int get(int X)() { return X; }
>> }
>>
>> void main()
>> {
>> RefCounted!Foo f;
>> writeln(f.get!123()); // Doesn't work either
>> }
>
>
> This is a problem.
>
>
> Andrei


More information about the Digitalmars-d mailing list