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

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

Thread Previous | Thread Next
Neil Bowers via perl5-porters
March 6, 2021 23:58
Re: Perl feature wish: quote-word array-ref operator
Message ID:
> 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About