--- On Mon, 4/1/10, yary <not....@gmail.com> wrote: > From: yary <not....@gmail.com>
> How about > multi sub foo(Any $name) { die "Houston, we have a major > malfunction."} Looks like tha would work, but it forces the developer to remember to write this extra code every time they may have a constraint failure, if they forget, we're back to the old, cryptic message. It would be much nicer to be able to do this (psuedo-code, obviouly): subset Filename of Str where { $_ ~~ :f } :OnFail { "No such file: '$_'" } subset Celsius of Num where { $_ >= -273.15 } :OnFail { "Celsius temperature should be a Num >= -273.15, not '$_' " } With something akin to that, developers won't have to write extra boilerplate every time a constraint fails. Plus, the code is friendlier :) Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Tech blog - http://use.perl.org/~Ovid/journal/ Twitter - http://twitter.com/OvidPerl Official Perl 6 Wiki - http://www.perlfoundation.org/perl6