develooper Front page | perl.perl5.porters | Postings from March 2021

Re: Perl feature wish: quote-word array-ref operator

Thread Previous | Thread Next
Martijn Lievaart
March 12, 2021 09:54
Re: Perl feature wish: quote-word array-ref operator
Message ID:
[ allow dashes in unquoted keys ]

Op 12-03-2021 om 10:35 schreef H.Merijn Brand:
> But the fat comma already makes an exception for leading dashes:
> $ perl -MData::Dumper -E'say Dumper ({ -key => 42, -value => "Boo" })'
> $VAR1 = {
>            '-key' => 42,
>            '-value' => 'Boo'
>          };
> So it *is* possible. I have no idea what the impact would be and I did
> not yet make up my mind if I want it myself.  Also no idea how much it
> would break (no breakage is an option to consider).

Although I wished for this feature often, it will break stuff subtly 
when someone used { a-b => 'c' }, where a and b are functions. Unlikely, 
but entirely possible. So I would say it is a no-go for this reason.



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