On Sat, Jun 13, 2009 at 02:49:10PM -0500, John M. Dlugosz wrote:
> Wow.  The overarching logic for list assignment would have to compare  
> the containers and the arguments in the capture before doing the list  
> assignment to each container, in order to avoid cloning all the  
> containers on the right first in the general case.  It can't just copy  
> values out because they may contain iterators or be lazy or be infinite.

Well, that's not really a problem, as long as the same semantics
are preserved.  All you need to do is cut loose the contents of the
container completely to the mercy of GC, build a new one with the
appropriate structure, then copy values in from the assignment's RHS.
The only reason Perl 5 couldn't do it this way is that the idiot who
wrote it prematurely optimized values on the stack so that they didn't
need to be reference counted. :)


Reply via email to