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

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

Thread Previous | Thread Next
From:
Scott Baker
Date:
June 7, 2022 14:30
Subject:
Re: Pre-RFC: syntax for quote-words-arrayref
Message ID:
bdaa3f03-4492-9a54-aadc-4356b5d11bb6@perturb.org
I agree with Mr. Mitchell. It's extremely easy to wrap your qw() in [ ] 
and get an array ref. I'd argue that's *more* Perly than creating a new 
qa() operator, as wrapping function calls, etc. in [ ] has the same output.

I would prefer *not* to add a new operator to do this.

Not to mention that two word operators are hard to Google.

On 6/7/2022 7:19 AM, Dave Mitchell 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.
>
>
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