develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #73666] *foo{SCALAR} autovivifies

Father Chrysostomos via RT
July 3, 2013 05:37
[perl #73666] *foo{SCALAR} autovivifies
Message ID:
On Mon Nov 15 02:00:48 2010, nicholas wrote:
> On Mon, Nov 15, 2010 at 09:40:28AM +0000, Zefram wrote:
> > Florian Ragwitz wrote:
> > >I wasn't aware of that. You're patch is obviously better. I'd love
> for
> > >it to go in if there's no objections to changing this very odd
> > >behaviour.
> Very odd, but very old.
> > When I posted mine some months ago, no one objected, though there
> was some
> > expectation that it would break a small number of modules.  They
> would
> > be easily fixed, of course, and it seems that no one thinks it
> enough
> > of a backcompat issue to stand in the way of the improved behaviour.
> I'm not *comfortable* with the change. When I changed the internals,
> to not
> allocate the SCALAR slot, I intentionally kept the Perl-space
> behaviour
> consistent, because my hunch was that there would be obscure code out
> there
> relying on it.
> I was part-way through trying to work out what on CPAN references
> *thingy{SCALAR}, and what would break. I think that it's this
> [comments date from mid-May]:
> Which I count as 16 (/will break/i + /BREAKS/i)
> But I'm not sure how many cascade failures it would cause, as my gut
> feeling
> is that it's low-level code that uses this, and changing it could
> produce
> weird failures, and action-at-a-distance failures. (Such as, "WTF
> isn't this
> scalar here a reference?". Autovivification happening within
> subroutines when
> it wasn't expected can have very strange side effects, such as updates
> not
> happening in larger data structures)

If we allow *foo{SCALAR} *assignment*, and deferred element magic too,
how does that change things?

(I would like to make glob elements assignable for other reasons, too. 
E.g., there are CPAN modules with hideous workarounds for the fact that
individual slots cannot be undefined.)


Father Chrysostomos

via perlbug:  queue: perl5 status: open Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About