On Wednesday, November 14, 2012 20:29:03 Don wrote: > It doesn't need to allocate any keys or values. It just needs to > allocate whatever structure it needs to keep track of how many items it > has. As if you added an element, and then removed it.
Except that that doesn't play nicely with init. Instead of using init, it would have to be default constructed, which goes against how every other type works and risks causing problems outside of the case where you simply declare an AA as a local variable. For instance, it wouldn't work at all when an AA is a member variable of a struct. I understand wanting to get rid of the magic initialization nonsense, but what it does is completely consistent with how dynamic arrays work, and making it work otherwise would make it inconsistent with every other type in D with regards to default-initiliazation. We _do_ need a way to indicate that an AA should be properly initialized without inserting anything into it (having to insert and then remove something to do that is atrocious), but I don't think that default constructing AAs will fly. - Jonathan M Davis
