AA key conversion woes

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Apr 17 14:17:38 PDT 2012


On Tue, Apr 17, 2012 at 10:13:49PM +0200, bearophile wrote:
> >http://d.puremagic.com/issues/show_bug.cgi?id=6253
> 
> Maybe it needs a bit more explanation. It goes according to this
> idea:
> http://en.wikipedia.org/wiki/Principle_of_least_astonishment
> 
> If I define:
> Foo[] a;
> I expect those Foo items to be mutable.
> 
> If I see:
> int[Foo]
> I expect those Foo keys to be mutable.
> 
> If I see:
> int[Foo]
> I expect those Foo keys to be mutable.
> 
> If I see:
> int[immutable Foo]
> I expect those Foo keys to be immutable.
> 
> If I see a int[Foo] and I get immutable Foo keys, I am astonished.
> 
> Not doing what I am saying here will add another special case to D
> language. Avoiding many special cases is one the reasons I program
> in D instead of C++.
[...]

So you're basically saying that we should refuse all non-immutable keys
in AA's?


T

-- 
Designer clothes: how to cover less by paying more.


More information about the Digitalmars-d mailing list