develooper Front page | perl.perl6.language | Postings from June 2006

Re: lexical lookup and OUTER::

Thread Previous
From:
Patrick R. Michaud
Date:
June 24, 2006 17:39
Subject:
Re: lexical lookup and OUTER::
Message ID:
20060625003853.GA11729@host.pmichaud.com
On Sat, Jun 24, 2006 at 04:52:26PM -0700, Audrey Tang wrote:
>     $x = 1 if my $x;
> 
> The compiler is "allowed" to complain, but does that means it's also  
> okay to not die fatally, and recover by pretending as if the user has  
> said this?
> 
>     # Current Pugs behaviour
>     $OUTER::x = 1 if my $x;

I think that a statement like  C<< $x = 1 if my $x; >> ought to
complain.  

Put slightly differently, if it's an error in any of the compilers,
it probably should be an error in all of them.

> If it's required to complain, then the parser need to remember all  
> such uses and check it against declaration later, and it'd be better  
> to say that in the spec instead.

I think that S04's phrase "then it's an error to declare it" 
indicates that this should always be treated as an error.  How/when
the compiler chooses to report the error is up to the compiler.  :-)
That said, I wouldn't have any objection to removing or altering
"the compiler is allowed to complain at that point" phrase so
as to remove this particular ambiguity.

Pm

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About