On Thu, Feb 15, 2001 at 02:03:21PM -0800, Edward Peschko wrote:
> > If I have:
> > 
> >     (my $foo1, $bar1) = (my $foo2, $bar2) = ("foo", "bar");
> > 
> > then '(my $foo1, $bar1)' is in void context, while '(my $foo2, $bar2)'
> > isn't.
> > 
> > Do you really want them to behave differently?
> > 
> > > best way to shoot down my suggestion is an example where existing behaviour
> > > can't be determined from void/scalar/list context.
> > 
> > Will the above do?
> 
> well, I'd say no. How many people are going to run into this and have it not 
> do what they expect as opposed to:
> 
> my $a, $b, $c;

The point isn't how many are going to run into this.

The point is how to determine when to warn or when not to warn.

It was suggested to DWIM when I use my in void context, and not when
my isn't used in void context. With the above example, such a rule
would mean '$bar1' is my()ed, and '$bar2' isn't. That's IMO, very hard
to explain, very hard to bugtrack and totally unexpected. Even if not
everyone uses it.

> However, I think that:
> 
> my $a, $b, $c;
> 
> and
> 
> my $a, $b, $c = @_;
> 
> should work the same and they wouldn't do so if 'void' context was the only 
> criteria used.

Both of the above my()s are in void context.

Also, if I have:

    @a = (1 .. 10);
    $a, $b, $c = @_;

$c becomes 10. Should $c become 3 when my is placed before $a?


Abigail

Reply via email to