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


<masak> TimToady: how do I get all the names the elements of an enum, in order?
<masak> TimToady: simplest one I've found so far is SomeEnum.pick(*).sort
<masak> hardly very idiomatic.
<TimToady> masak: you might try SomeEnum::.keys since Type:: is
supposed to be the stash of the type; no guarantees about rakudo
though
<masak> TimToady: oki, thanks.
<TimToady> doesn't guarantee order either
<TimToady> though of course, enums are only conventionally in a particular order
<TimToady> they're just a convenient way to write a lot of constants

<masak> rakudo: enum SomeEnum <a b c>; say SomeEnum::.keys
<masak> locally, I get "invoke() not implemented in class 'Perl6Role'"
<p6eval> rakudo 7347ec:  ( no output )
<masak> is that worth a rakudobug submission?
<masak> std: enum SomeEnum <a b c>; say SomeEnum::.keys
<p6eval> std 29203: ok 00:01 106m␤
* jnthn looks confused at what the intent was there
<jnthn> Oh
<jnthn> Treating it as a namespace...hm
<masak> yah. a stash, said TimToady.
* jnthn is vaguely surprised Rakudo even parses that.
<masak> heh.
<jnthn> I guess if it ends with :: we're meant to treat it as a
stash...I guess I can go with that.
<jnthn> File rakudobug if you like.
* masak likes

Reply via email to