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 10, 2021 17:55
Subject:
Re: Perl feature wish: quote-word array-ref operator
Message ID:
9cebf38e-54de-e6fb-4aae-5734a081fb86@rtij.nl

Op 10-03-2021 om 17:12 schreef Felipe Gasper:
>
>> On Mar 10, 2021, at 3:09 AM, Smylers <smylers@stripey.com> wrote:
>>
>> Felipe Gasper writes:
>>
>>> Perl, for better or for worse, suffers a reputation as being hard to
>>> read. In that light, I do think special care is justified when adding
>>> additional ways to do everyday tasks like creating an array reference.
>> As Eirik said, I think this makes code _easier_ to read. Less
>> distracting clutter of multiple nested brackets, or trying to work out
>> what each do.
> As I wrote earlier, there are wins and losses. Less syntax is a readability win, but having multiple ways to do familiar things is a loss. For example, if I write:
>
> my $foo = [ 1, 2, 3 ];
>
> my %bar = (
>      abc => qa/a b c/,
>      def => qa/d e f/,
> );
>
> my @baz = qw/ ha ha ha /;
>
> … then someone has to grok both syntaxes for arrayref-literal creation, as well as qw, in order to comprehend the code.

/delurk


I am an oldtimer, but the code above reads as a win for me. Extremely 
easy to grok.


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