# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #119749]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119749 >
<poor_soul> is it ok for this to crash?
<poor_soul> r: enum A (a=>3,b=>10,c=>1); class B { BEGIN for
A.enums.kv -> $k, $v { our $k ::= $v }; }; say B.b
<camelia> rakudo 69c3cc: OUTPUT«===SORRY!===Null PMC access in get_bool()»
<tadzik> certainly not in this way
<masak> poor_soul: certainly not ok.
* masak submits rakudobug
<mathw> "Null PMC access" is always a bug, IIRC
<moritz> overwriting B::k with each enum value in turn doesn't sound too useful
<poor_soul> i was trying to find a way to declare constants in a class
based on a enum
<jnthn> poor_soul: Does declaring the enum in the class not do it? :)
<poor_soul> jnthn: it does only partially, since if i want to use it,
i need to put the name of the enum
<jnthn> r: class A { enum B <c d e>; method m() { say e } }; A.m
<camelia> rakudo 69c3cc: OUTPUT«e»
<jnthn> r: class A { enum B <c d e>; method m() { say +e } }; A.m
<camelia> rakudo 69c3cc: OUTPUT«2»
<masak> r: enum A (a=>3); class B { BEGIN for A.enums {} } # golf'd
<camelia> rakudo 69c3cc: OUTPUT«===SORRY!===Null PMC access in get_bool()»
<masak> ooh, in fact...
<masak> r: enum A (a=>3); BEGIN for A.enums {}
<camelia> rakudo 69c3cc: OUTPUT«===SORRY!===Null PMC access in get_bool()»
<jnthn> Short names seem to work to me.
<jnthn> r: enum A (a=>3); BEGIN A.enums
<camelia> rakudo 69c3cc: ( no output )
<jnthn> r: enum A (a=>3); BEGIN A.enums.perl.say
<camelia> rakudo 69c3cc: OUTPUT«("a" => 3).hash»
<jnthn> r: enum A (a=>3); BEGIN { for A.enums { }; 1 }
<camelia> rakudo 69c3cc: ( no output )
<jnthn> r: enum A (a=>3); BEGIN { for A.enums { } }
<camelia> rakudo 69c3cc: ( no output )
<jnthn> r: enum A (a=>3); BEGIN for A.enums { }
<camelia> rakudo 69c3cc: OUTPUT«===SORRY!===Null PMC access in get_bool()»
<jnthn> wow...you need the blockless form to trigger it.