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

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

Thread Previous
From:
Dan Book via RT
Date:
April 14, 2018 00:52
Subject:
[perl #133109] push on scalar forbidden: why?
Message ID:
rt-4.0.24-23916-1523667163-524.133109-15-0@perl.org
On Fri, 13 Apr 2018 17:32:21 -0700, philiprbrenan@gmail.com wrote:
> 
> 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.

Just for reference, this can also be written as push $a{0}->@* on Perl 5.24+ (or slightly earlier with the experimental feature). That might be more palatable to some when it comes to long dereference chains.


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133109

Thread Previous


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