# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #69967]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=69967 >


In Rakudo 4c248e5c, constants can no longer be used inside of classes.

$ perl6 -e'class A { constant B = 5; has $!x = B }; A.new'
Null PMC access in isa()
[...]
$ perl6 -e'class A { constant B = 5; has $!x = A::B }; A.new'
Null PMC access in isa()
[...]

I'm pretty sure this used to work before jnthn++'s merge. Which means
we probably don't have a spectest for this.

Sadly, it's not possible to refer to constants-defined-outside-a-class
from within the class either.

$ perl6 -e 'constant B = 5; class A { has $!x = B }; A.new'
Lexical 'B' not found

Here's a clean workaround, for those who want something like constants
in a class:

$ perl6 -e 'class A { sub B { 5 }; has $.x = B }; A.new.x.say'
5

Reply via email to