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

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

Thread Previous | Thread Next
From:
Philip R Brenan
Date:
April 14, 2018 00:32
Subject:
Re: [perl #133109] push on scalar forbidden: why?
Message ID:
CALhwFRnAW3U3YQtSn=YEyv4M7RHqYmsfCp6gwRc-PFoEESRY0Q@mail.gmail.com
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
like:

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


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