develooper Front page | perl.perl5.porters | Postings from June 2015

Re: extraneous autovivification (foreach (@$x), keys(%$x), ...)

Thread Previous | Thread Next
From:
Aristotle Pagaltzis
Date:
June 30, 2015 23:57
Subject:
Re: extraneous autovivification (foreach (@$x), keys(%$x), ...)
Message ID:
20150630235659.GA45840@plasmasturm.org
* Christian Millour <cm.perl@abtela.com> [2015-07-01 01:40]:
> interestingly, foreach (@{...}) defeats 'no autovivification' :

I’m not surprised, as this is not rvalue context: foreach really does
evaluate the expression in lvalue context, so this is expected. But it
really only needs lvalueness for individual items – semantically, the
expression that generates them should be in rvalue context, as Leon has
already pointed out. I don’t know if that is implementable, though. If
it is, it would be worth a shot at fixing.

(NB.: I don’t know how autovivification.pm actually goes about achieving
its effect at a guts level, so I may be unsurprised for the wrong reason
as far as that pragma is concerned. The above reasoning is WRT Perl.)

-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

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