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

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

Thread Previous | Thread Next
From:
Neil Bowers via perl5-porters
Date:
March 6, 2021 23:58
Subject:
Re: Perl feature wish: quote-word array-ref operator
Message ID:
22ed2780-59ea-420f-8c82-075e87dda81c@Spark
> Even better :
>
> use autoref; my $a = qw(a b c);  is_deeply $a, ['a','b','c'];

I think this would be worse, and not better. As I noted in another reply, changes to the language should preferably improve the consistency and predictability / grokability of code, and at least not reduce it.

Imagine the world where the autoref pragma exists: you’re looking at a non-trivial file, and you come across this line of code:

    my $a = qw( a b c );

What’s going on here depends on whether you find "use autoref" at the top of the file. That’s not an improvement.

Right now, if I saw that line, I’d assume it’s a mistake, and I think that’s right.

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