On Thu, Jul 14, 2005 at 04:17:14PM -0700, Michael G Schwern via RT wrote: > So, to sum up... I think we all agree these should all warn. > > my $x; our $x; # this currently does not > our $x; my $x; > my $x; my $x; > our $x; our $x; > > and that this should not > > package Foo; > our $x; > > package Bar; > our $x; > > but this appears to be up in the air: > > package Foo; > my $x; > > package Bar; > our $x; > > Currently this warns. Rick's patch to fix "my $x; our $x;" changes this > so that it does not warn on the grounds that the "package Foo; our $x; > package Bar; our $x" case doens't warn either.
My patch doesn't change that case. It still warns. It does change package Foo; our $x; package Bar; my $x; This currently warns. After the patch it doesn't. The reason is as described above. More specifically, we don't see a need for a warning when we mask an our variable that was declared in a different package than the current package we are declaring in. I think whether we are declaring a my or our variable should make no difference. They are both masking the same thing in the exact same way. > But I say that's a > special case to do with the fact that our's mix of two scoping > mechanisms, lexical and package, runs afoul of multi-package-in-one-file > programming idioms. > > package Foo; > our @ISA = qw(...); # or $VERSION or @EXPORT or ... > > package Bar; > our @ISA = qw(...); > > There's no corresponding idiom for "package Foo; my $x; package Bar; our > $x" or vice-versa. Therefore, it should warn about the mask. I am almost convinced by this argument. -- Rick Delaney [EMAIL PROTECTED]