On Thu, Mar 11, 2010 at 04:28:23PM +0000, Allison Randal wrote:
> Given that the primary purpose of core PMCs like hash and array is
> to provide simple default behaviors for various language
> implementations, I'm okay with making them shallow clones rather
> than deep clones (after a suitable deprecation cycle, and a chance
> for current HLL devs to let us know if this is likely to cause them
> problems).

The current situation is indeed a pain, primarily because the Hash PMC
defaults to a deep clone.  So, it's not only inconsistent with the
cloning semantics of Parrot's other core PMCs, but Hashes show up in
a lot of places (namespaces, method tables, lexpads), with the result
that unintentionally cloning one of these can become a very expensive
operation, and end up with copies of objects where the programmer
expected a reference to the original object.

RT #48112 also remarked on the issues of deep-versus-shallow clone
semantics, but nobody ever responded to the ticket so I eventually
closed it as being a "non-issue".  I'm glad to see it coming up for
discussion again.

>From a Rakudo and NQP perspective, we'd really prefer that Parrot's
core PMCs default to shallow clone semantics, and _particularly_ that
Hash should default to shallow cloning.

Pm
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Reply via email to