Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Revert qw-as-parens deprecation for for loops #26

@rurban

Description

@rurban

The rationale to remove the for qw() syntax was bogus and annoying.
re-instate it for for loops, but not for the rest.
do not insist on the backwards syntax to require (qw( ... )) around the for list.

Keep qw() as list for for and foreach but not as lists for
if, given, when, while, until, elsif and function calls.

Use of qw(...) as parentheses is disallowed for:

    if qw(a) {}
    unless qw(a) {}
    if (0) {} elsif qw(a) {}
    given qw(a) {}
    when qw(a) {}
    while qw(a) {}
    until qw(a) {}
    $obj->meth qw(a b c)
    do foo qw(a b c)
    do $subref qw(a b c)
    &foo qw(a b c)
    $a[0] qw(a b c)

but allowed for (foreach also):

    for qw(a b c) {}
    for $x qw(a b c) {}
    for my $x qw(a b c) {}
    for my \$x qw(a b c) {}

commit 417a992
Author: Zefram zefram@fysh.org
Date: Fri May 25 22:25:21 2012 +0100

remove deprecated qw-as-parens behaviour

commit ea25a9b
Author: Zefram zefram@fysh.org
Date: Wed Sep 8 09:51:29 2010 +0200

make qw(...) first-class syntax

This makes a qw(...) list literal a distinct token type for the
parser, where previously it was munged into a "(",THING,")" sequence.
The change means that qw(...) can't accidentally supply parens to parts
of the grammar that want real parens.  Due to many bits of code taking
advantage of that by "foreach my $x qw(...) {}", this patch also includes
a hack to coerce qw(...) to the old-style parenthesised THING, emitting
a deprecation warning along the way.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions