Patrick (>), Carl (>>): >> 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.
It's funny that this bug resurfaces just as I try something like this in Rakudo: class SomeClass { my $.warn_limit = 1000; my $.stern_warn_limit = $.warn_limit * 1.05; my $.expel_limit = $.warn_limit * 1.10; # ... } And have it fail. Were my assumptions unreasonable in the above case? I don't think so, but OTOH I don't find something in S12 that talks about this, so I think I'm on unspecced territory. I'll re-pose this question to p6l. // Carl