AA char[] as key

Andrew Wiley wiley.andrew.j at gmail.com
Tue Jan 3 15:40:06 PST 2012


On Tue, Jan 3, 2012 at 4:20 PM, bearophile <bearophileHUGS at lycos.com> wrote:
> Andrew Wiley:
>
>> If the compiler is basically going to disallow using the AA as
>> anything but a long[string], it should really disallow declaring
>> anything with a mutable key type. Disallowing mutable keys at that
>> assignment site but allowing them in the type is confusing.
>
> Two related bug reports:
> http://d.puremagic.com/issues/show_bug.cgi?id=4475
"Improving the compiler 'in' associative array can return just a bool"
Whether this is a good idea or not is a moot point. Changing this
would break too much code (basically all code that uses AAs
significantly).

> http://d.puremagic.com/issues/show_bug.cgi?id=6253
"Refuse definition too of impossible associative arrays"

This is what we're discussing.
Some consequences of actually changing this:
- This breaks D1 compatibility of AAs across the board because
immutable simply didn't exist then
- Significant D2 code breakage as well

We might see if Walter is willing to add this as a warning and/or
deprecation to see whether it's actually feasible to disallow it
completely.


More information about the Digitalmars-d-learn mailing list