Sean O'Rourke wrote: > On Sun, 4 Aug 2002, Mike Lambert wrote: > >>Unfortunately, this causes different semantics for whether you are storing >>primitives or pointers (primitives copy, whereas pointers are shallow). Of >>course, one could argue that the previous one didn't work at all. :) >> >>Thoughts? >> > > Well, it's certainly wrong (though very efficiently so!) -- it needs to > call string_copy for strings and vtable->clone for pmc's (attached). > > Are hashes the only (non-packed) containers we'll have to worry about > holding things other than PMC's, or will arrays need this same snippet?
[ patch ] if would first hash_put the values, which copies primitives and afterwords copy strings or clone PMCs. perlarrays currently store PMC only, which get cloned, so no problem. Currently perlhash has KEY_ATOM values (perl6 only uses PMC) and perlarray has PMC values. But what about (exe2): my int @a is dim(1_000_000); This sould definitly be an array of natural ints, not perlint's aka PMCs. Using KEY_ATOMs would be wasting space too. > /s leo