On Wed Jul 14 16:25:26 2010, cognominal wrote: > Here, the where clause is applied to the default value, the undefined > type Any > and results in an error. > > $ perl6 > > sub a(Range $r? where {$r.min >= 0} ) {}; a() > Type objects are abstract and have no attributes, but you tried to > access $!min > > >
Rejecting this one - it's behaving as expected. From #perl6: 12:31 <@jnthn> Opinions on http://rt.perl.org/rt3/Ticket/Display.html?id=76514 ? 12:31 <@jnthn> Tempted to reject as "not a bug". 12:31 <@jnthn> Default values should be subject to checking too. 12:32 <@moritz_> +1 12:32 <@jnthn> (and sticking in the Range type object is just a kinda default value) 12:32 <@moritz_> the correct solution is to supply a custom default value, of course 12:36 <@jnthn> OK, thanks. :-) Essentially, if you're going to put constraints on a parameter or variable, then those constraints should always apply. You could: * Supply a default value * Tweak the constraint to allow !$r.defined || $r.min >= 0 To resolve this. Thanks, Jonathan