StÃphane Payrard writes:
>
> Giving scoping functions the status of list operators
> would allow to drop parentheses when not used in conjunction
> with initializer so one could write:
>
> my $a, $b, $c;
>
> instead of
>
> my ($a, $b, $c);
Hmm, but that kills the Perl 5 ability to do concise inline 'my's:
while my $line = =$fh {...}
However, since 'for' is getting revamped so that there isn't a need to
use inline 'my' as much, your proposal might be going somewhere. As you
point out, we don't have a low precedence equals, so we're just creating
a red herring:
my $x, $y; # fine
my $x, $y = (1, 2); # oops!
We have discussed making equals low precedence enough to eliminate the
parentheses in the standard swap:
$x, $y = $y, $x;
But there are a couple of arguments against that. First, Perl
programmers like to make assignments within listops. Second, the
parentheses make a nice visual "pill" so that you can easily see the
multiple assignment.
I don't think it's a good idea to make a new low precedence assignment.
Let's say we made it <-. Does that imply that there is also
low-precedence binding :<- and compile-time binding ::<- ? Those don't
look right. I think we're weighing making good ol' assignment low
precedence vs. having parentheses on 'my'.
Luke