On 5/3/2009 6:36 AM, Denis Koroskin wrote:
On Sun, 03 May 2009 01:02:41 +0400, Tyro[a.c.edwards] <[email protected]>
wrote:

On 5/3/2009 3:44 AM, flourish wrote:
Hi,

why does the following code not compile -- or how to declare a (usable)
property of an associative array field?

//////////////////////
class Test
{
private int[int] _testMap;
public int[int] testMap() {return _testMap;}
}


testMap() is a getter and can only return the value it is designed to.
You must implement a setter to accomplish what you are trying to di.
Unfortunately I'm not sure how you do that with AAs so I'll leave that
to someone that's a little smarter than I.

[...]

No, you are wrong, testMap works like a property here. I believe,
original code _should_ work. For example, it works if you replace
int[int] with int[].
All the trouble is because of an awful properties implementation in D,
and temporaries not being able to be passed by reference:


Thanks for the clarification.

Reply via email to