ref keys
Jonathan M Davis
jmdavisProg at gmx.com
Mon Sep 17 10:32:40 PDT 2012
On Monday, September 17, 2012 15:42:55 Namespace wrote:
> Until now it is possible to have const keys in assocative arrays,
Keys are supposed to be immutable. If that's not enforced by the compiler,
then it's a bug. Given the current issues with the implementation for AAs' it
wouldn't surprise me in the least if the compiler does not enforce this like
it's supposed to, but regardless, that's the design. All AA keys must be
immutable (or implicitly convertible to immutable) so that they can never
change and screw up your AA.
So, all AA key types are supposed to be inferred as immutable if they're not
explicitly marked as such, and any time that an AA is accessed, the key used
must either be immutable or implicitly convertible to immutable. And in the
case of classes, that means that it must be outright immutable.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list