When I tried implementation of Unique which was not usable at all though it was listed in a document, I faced a similar problem.
The patch of Kenji is intended to just solve this.
Even if these patch applied, some problems are left. (e.g. Automatic definitions of the opEquals function for Objects / see also: https://github.com/D-Programming-Language/druntime/pull/72 )
However, I think that the priority of these pull request is high.

On Tuesday, 27 December 2011 at 11:27:43 UTC, kenji hara wrote:
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 <seewebsiteforem...@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


Reply via email to