On Tue, Jan 3, 2012 at 4:20 PM, bearophile <[email protected]> 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.
