On 09/17/2010 06:48 PM, Michel Fortin wrote:
On 2010-09-17 11:14:21 -0400, Andrei Alexandrescu <[email protected]> said:Now that I think of it, you don't need a fancy struct to make this problem appear, you just need two layers of functions: void fun(const(int[int]) hash) { fun(hash); // calling ourself, how can we copy hash? } Although in this case we could probably assert() that hash is already initialized. In my mind it's simpler to just explain the notion that an uninitialized hash is null and detached from anything else until initialized. Objects works like this (minus the implicit initialization part), so it shouldn't be too hard to understand. Better have pragmatic semantics that work rather than idealistic semantics that fail at a number of cases.
Another difference between object and AA - if one wants to initialize a class object reference, he does it with a sane syntax. To eagerly initialize an empty AA, woodoo is needed.
