qw() in list context deprecated

Someone decided that using `for var qw()` should be forbidden, you have to write explicitly now `for ... (qw())` instead of `qw()` beginning with 5.14. WTF

5.14 seemed to be a fine release for me, the first in a long time which is actually faster then most of the previous ones. And there were not too many languages policists.
But this new qw() deprecation warning is just pure nonsense.

`qw` used in for list where only list-context can be used should still be allowed.
Why should I be forced to update all my code to add `()` around `qw()` only because it seems to be "right". perl has let you use handy shortcuts forever.

for my $a qw() {} => for my $a (qw()) {}

How awful!

$ perl5.13.5 -e 'for my $a qw(1 2) {print $a;}'

Use of qw(...) as parentheses is deprecated at -e line 1.
12

$ perl5.13.4 -e 'for my $a qw(1 2) {print $a;}'
12

$ perl5.13.4 -e 'require B; B->import qw(main_root)'

$ perl5.13.5 -e 'require B; B->import qw(main_root)'
Use of qw(...) as parentheses is deprecated at -e line 1.

There is no other context possible for the `qw` here than list context,
so perl should be consistent with other list grabbing functions like print
and don't enforce quotes were they are not needed.

This is certainly not DWIM, this is language police.

The language police should rather think of getting rid of more unneeded syntax, than enforcing it.

`for my $var` always should eat the next tokens as list members until the block. Parens are really not needed here.

$ perl -e 'for my $a 1,2 {print $a;}'
=> syntax error

There's nothing else possible than a list context after the for variable.

I think the title of this blogpost is greatly misleading. In 99% of it's uses, qw// can still be used in places where it is currently used. In fact your examples are pretty much the only ones where they can't.

In the old parser, qw// allowed you to omit otherwise mandatory parentheses in a very select set of circumstances. For-statements (but only when they have an explicitly named iterator) and methods calls are such cases. In both of these circumstances the parentheses have very specific meanings that are different from being a list. The old behavior should never have been allowed in the first place.

This change is for good reasons (the way the lexer currently implements qw is quite insane, inserting tokens that aren't really there). For a detailed explanation see this thread.

you have to write explicitly now `(qw())` instead of `qw()` beginning with 5.14.

Entirely untrue. qw() still behaves the same in all contexts except for one, which is

for $_ qw(foo bar) { ... }

That is, in situations where perl's syntax normally requires parens, but qw() could be used to omit them. This being allowed was simply an odd side-effect of how the parser was written, and has now been fixed.

Zefram started this deprecation with "Damien will probably hate me".
I'm sure Damien is not the only one. There will be thousands of Damiens's.

Parser internal hacks should NOT burden the poor user from being forced to add unneeded sugar. This harms perl at all. Even if was an internal hack. Whole perl core is a hack.

The fact that it was pretty easy to add the needed () around the qw for the new parser rule proves that it's police ruling at p5p now. I want the hackers back.

But now that 5.13.4 is the slowest of all perls so far, my first excitement with 5.13.3 which was the fastest since 5.6 is already gone.
5.14 will be a lame duck again. So this new deprecation warning only adds to the overall picture.

Everything old is new again. Permitting "for qw(foo bar) { ... }" was new in 5.8, as I recall. Prior to that, you *had* to write "for (qw(foo bar)) { ... }". I think we're just heading back there. But why?