Writing something like this in Rakudo yesterday, I was slightly
surprised to find it not working:

class SomeClass {
     my $.warn_limit = 1000;
     my $.stern_warn_limit = $.warn_limit * 1.05;
     my $.expel_limit = $.warn_limit * 1.10;

    # ...
}

The specific error from Rakudo is "Lexical 'self' not found", which
translated into English means "You're trying to access an object [the
protoobject] that doesn't exist yet".

I think that the above is a very reasonable way to declare class-scope
variables in Perl 6, and I just wanted to get confirmation that this
should in fact work in Perl 6. I don't see read access to class-scope
variables from the same class scope addressed in the specification.

// Carl

Reply via email to