Given this code:

    subset Filename of Str where { $_ ~~ :f };

    sub foo (Filename $name) {
        say "Houston, we have a filename: $name";

    my Filename $foo = $*EXECUTABLE_NAME;

We get this output:

    Houston, we have a filename: /Users/ovid/bin/perl6
    Houston, we have a filename: /Users/ovid/bin/perl6
    Constraint type check failed for parameter '$name'
    in Main (file src/, line 324)

Obviously the error message can use some work, but how would I customize that 
error message (assuming such will be possible in the future)?  Clearly there 
will be many cases where a custom error message for constraint failure could 
make life much easier for developers.

Buy the book         -
Tech blog            -
Twitter              -
Official Perl 6 Wiki -

Reply via email to