publiustemp-perl6interna...@yahoo.com (via RT) wrote:
For r35004:
subset Even of Int where { not $_ % 2 };
my Even $num = 2;
say $num;
say $num.WHAT;
Output:
2
Int
I'm expecting:
2
Even
I think the current behaviour is correct (or at least, implemented to
match my understanding of the Perl 6 type system). You're asking for the
type of the value stored in $x, which is an Int.
Even is not a "real type", but rather a refinement type. It is set as a
constraint on what may be held by the container. To get hold of that
(though I don't think we implement any way right now) you probably would
write $x.VAR.type or some such (I'm not sure exactly what the name of
the method on the container that hands this back should be).
Hope this makes sense,
Jonathan