On 7/15/05, Michael G Schwern via RT <[EMAIL PROTECTED]> wrote:
> So, to sum up... I think we all agree these should all warn.
> 
>     my $x;  our $x;  # this currently does not

That's a bug.

>     our $x; my $x;
>     my $x;  my $x;
>     our $x; our $x;

I disagree. This shouldn't warn. There is no masking, as demonstrated by :
$ perl -e 'our $x=42; our $x; print $x'
42

> and that this should not
> 
>     package Foo;
>     our $x;
> 
>     package Bar;
>     our $x;

Yes.

> 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.  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.

I agree with this.

I fact I think I'd prefer not to change the cases where the masking
warning is emitted purely based on the presence on package
declarations. Declaring a default namespace is one thing, and doesn't
affect lexically-scoped names specified with my/our. The two
declaration operations are orthogonal. Don't mix them and avoid
special cases.

Reply via email to