On Monday, 17 September 2012 at 13:42:08 UTC, Namespace wrote:
I can do:
array[new A()] = 42;
array[a1] = 23;

Both lines are valid.
But if I would access the elements later with their keys, I can't because I have not a valid key for the element 42, only for 23.

so my suggestion is: allow ref keys.

int[ref A] array;
array[new A()] = 42; // <-- error, new A() isn't a lvalue
array[a1] = 23; // <-- fine

What problem are you trying to solve here? When I forget to keep the key around, I'll notice that. I don't need lvalue keys for that.

Reply via email to