AA key conversion woes
Jonathan M Davis
jmdavisProg at gmx.com
Tue Apr 17 18:55:18 PDT 2012
On Tuesday, April 17, 2012 14:17:38 H. S. Teoh wrote:
> So you're basically saying that we should refuse all non-immutable keys
> in AA's?
I would not be against enforcing that all key types be immutable or implicitly
convertible to immutable. So, something like int[Foo] would be illegal unless
Foo was a struct which could be implicitly converted to immutable.
But there's certainly an argument for allowing non-immutable key types in the
declaration and automatically tacking on immutable so that int[Foo] is legal,
but is of course really int[immutable Foo].
Allowing int[Foo] has the benefit of brevity but with a cost in clarity. The
fact that int[Foo] is currently allowed though is a definite argument against
making it illegal.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list