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

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

Thread Previous | Thread Next
From:
Christian Millour
Date:
June 30, 2015 23:37
Subject:
Re: extraneous autovivification (foreach (@$x), keys(%$x), ...)
Message ID:
55932814.4060601@abtela.com
Le 01/07/2015 00:02, Ricardo Signes a écrit :
> * Aristotle Pagaltzis <pagaltzis@gmx.de> [2015-06-30T17:16:14]
>> Maybe we cannot change that now. And if we cannot change it, we cannot
>> change it. But I wish we *knew* that, for having tried it – instead of
>> just forever wondering.
>>
>> And maybe we would instead find that we can.
>
> First, could we control this lexically so that we had a proper core version of
> "no autovivification" that didn't mean we have to pester Vincent every time we
> change the internals?
>

interestingly, foreach (@{...}) defeats 'no autovivification' :

$ perl -Mautovivification -MData::Dump -E'no autovivification; dd $x; $y 
= $x->{a}{b}{c}; dd $x; frob for @{$x->{foo}}; dd $x'
undef
undef
{ foo => [] }
$

Please note that this is with an old perl and old autovivification, as 
it looks like I cannot build the latest autovivification on strawberry 
perl portable 5.22
$ perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for 
MSWin32-x86-multi-thread
$ perl -Mautovivification\ 9999
autovivification version 9999 required--this is only version 0.12.
BEGIN failed--compilation aborted.
$


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