develooper Front page | perl.perl5.porters | Postings from December 2017

Re: [perl #132588] In-place sort does not kill weak refs

Thread Previous | Thread Next
From:
Zefram
Date:
December 15, 2017 22:41
Subject:
Re: [perl #132588] In-place sort does not kill weak refs
Message ID:
20171215224131.GE25404@fysh.org
Father Chrysostomos wrote:
>$ perl5.27.7 -le 'use Scalar::Util "weaken"; weaken ($a = \$_[0]); @_ = sort @_; print $a; print \$_[0]'

After coming up with blessedness and then tiedness, I was wondering what
other kinds of magic might be applied to an array element, and how sort
would need to treat them.  This one confirms that in general sort needs
to take the slow path for any kind of magic.  We don't distinguish between
magic that's part of the container and magic that's part of the value, but
we have little of the latter, so wouldn't lose much by not catering to it.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About