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

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

Thread Previous | Thread Next
From:
"G.W. Haywood" via perl5-porters
Date:
June 7, 2022 15:51
Subject:
Re: Pre-RFC: syntax for quote-words-arrayref
Message ID:
64e5ba6a-c5c2-b894-a42d-5b637faf1545@jubileegroup.co.uk
Hi there,

On Tue, 7 Jun 2022, Felipe Gasper wrote:
>
>> 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.

+1

-- 

73,
Ged.
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