On Sat, 23 Jul 2016 15:57:33 -0700, gfldex wrote:
> sub niler{Nil}; my Int:D $i where .defined = niler(); say $i; say $i.WHAT;
> # OUTPUT«(<anon>)(<anon>)»
> # expected: well, I don't know since I explicitely asked for a defined
> # value _twice_ but Nil is supposed to revert a container to it's default.
> # That default is undefined, what can't work with $_.defined and should
> # work (by design, not my opinion) with :D.
> # Either way, I would like to get a type object when asking for WHAT.
> # may be related to RT#127958
Thanks for the report.
It's not empty. In both cases it says "<anon>", because you've used a `where`
clause, thus creating an anonymous (nameless) subset.
If you prefer it to have a name, you can define a named subset instead:
<Zoffix__> m: my Int $i where 42; say $i;
<camelia> rakudo-moar bfb5279aa: OUTPUT: «(<anon>)»
<Zoffix__> m: subset Foo of Int where 42; my Foo $i ; say $i;
<camelia> rakudo-moar bfb5279aa: OUTPUT: «(Foo)»
I made a patch that makes it say "<Int-based anon subset>" instead, but in the
end decided against it,
because we use '<anon>' in many other places and this breaks that consistency,
without adding much of extra information.
[1] https://gist.github.com/zoffixznet/198403153020a20b427bb2088b118ecc
Closing this as wontfix.