develooper Front page | perl.perl5.porters | Postings from June 2022

Re: Pre-RFC: syntax for quote-words-arrayref

Thread Previous | Thread Next
From:
Felipe Gasper
Date:
June 7, 2022 14:59
Subject:
Re: Pre-RFC: syntax for quote-words-arrayref
Message ID:
21410EF6-ED47-42F3-A49D-740A242EDB64@felipegasper.com

> On Jun 7, 2022, at 10:19, Dave Mitchell <davem@iabyn.com> wrote:
> 
> On Tue, May 31, 2022 at 08:40:52AM +0100, Neil Bowers wrote:
>> In early March last year, I proposed[1] new syntax for "quote words arrayref",
>> so that the following:
>> 
>>     $a = [qw/ a b c /];
>> 
>> could be replaced with:
>> 
>>     $a = qa[ a b c ];
> 
> My personal feeling is that that it adds complexity for very little gain.
> If people want an array ref they just wrap the qw() in []'s. It's visually
> obvious then that an array ref is being created.
> 
> With qa() you now require programmers to remember another fact. Each
> little fact on its own isn't a great burden, but perl has accumulated
> zillions of such factlets, which cummulatively make perl hard to use.
> 
> Now you will have things like
> 
>    foo(qw(a b c));
>    foo(qa(a b c));
> 
> doing two completely different things, and the programmer may get confused.
> People already find qw() confusing enough - e.g. whether it parses commas;
> now they will have to remember whether qa() obeys the same parsing rules
> as qw(). Etc.

This remains my own sense, too: the gains in concision this would facilitate don’t justify the addition of yet another syntactic variant to a language that already maintains an overabundance of such.

-F

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