develooper Front page | perl.perl5.porters | Postings from April 2018

Re: [perl #133109] push on scalar forbidden: why?

Thread Previous | Thread Next
Philip R Brenan
April 14, 2018 00:32
Re: [perl #133109] push on scalar forbidden: why?
Message ID:
The initial experimental form was a good idea but too broad because of the
interpretation of:

for($a) {...}

But when it was removed the removal was perhaps too broad as well and
perhaps should not have been removed from pop, push, shift, unshift where
it seems plausible that an extra @ can be safely added. I thought that
perhaps Linda's scheme would fail on:

my $a;
for(keys $a) {...}

but in this case the point is moot so the scheme survives.  And in cases

my %a = (0=>undef);
push @{$a{0}}, 1;
say STDERR dump(%a);

it would make code much more readable.

If Linda's scheme can be shown to be safe and unambiguous on all cases of
pop, push, shift, unshift then I would like to see this capability returned
to Perl because it is more concise.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About