Re: getting the face value of an enum

2009-01-14 Thread Larry Wall
On Wed, Jan 14, 2009 at 02:26:23PM +0300, Richard Hainsworth wrote: > S12 defines enums and rakudo impliments them, so > perl6 > > enum wkend <>; my $x = Sun; say $x > 1 > > But suppose I want to get the "face value" of $x, viz., 'Sun'? > > How do I get it? > > say $x.key doesnt work. Why not just

Re: getting the face value of an enum

2009-01-14 Thread Richard Hainsworth
Can I suggest a new method to be declared with enums, viz. .face enum day <>; my $today does day; $today = prompt "Type in a day of the week "; #later say $today ; # prints 3 say $today.face; #prints Wed Whilst having an enum being a list of values is useful, not being able to restore the

Re: getting the face value of an enum

2009-01-14 Thread Carl Mäsak
Richard (>): > S12 defines enums and rakudo impliments them, so > perl6 >> enum wkend <>; my $x = Sun; say $x > 1 > > But suppose I want to get the "face value" of $x, viz., 'Sun'? > > How do I get it? > > say $x.key doesnt work. Far as I know, the answer to your question is unspecced. (Yes, that

getting the face value of an enum

2009-01-14 Thread Richard Hainsworth
S12 defines enums and rakudo impliments them, so perl6 > enum wkend <>; my $x = Sun; say $x 1 But suppose I want to get the "face value" of $x, viz., 'Sun'? How do I get it? say $x.key doesnt work.