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

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

Thread Previous | Thread Next
From:
Martijn Lievaart
Date:
March 12, 2021 09:54
Subject:
Re: Perl feature wish: quote-word array-ref operator
Message ID:
dbee8b1b-540a-0e1c-2977-0d39be4e30c4@rtij.nl
[ 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.


HTH,

M4



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