On Tue Aug 12 14:17:20 2008, masak wrote:
> r30188:
> $ ./perl6 -e 'class A { my $.x = 7; say $.x }' # segfaults
> Lexical 'self' not found
> [...]
> Segmentation fault
> 
> Not sure if the error message from Pugs is right either. Should it be
> looking for 'self' at this stage? What should the program really do,
> print out the variable or disallow statements within a class
> declaration but outside methods?

Since $.x is really equivalent to self.x, I suspect that Rakudo and Pugs
have this one correct and using $.x in the say statement is an error. 
Either that or the body of the class declaration needs to have an
implicit self (perhaps the protoobject?).  We probably need
clarification from p6l on this one.

AFAIK, statements are definitely allowed in method and class declaration
bodies.

Pm

Reply via email to