On Tue, Jan 5, 2010 at 11:18 AM, Ovid <publiustemp-perl6langua...@yahoo.com> wrote: > --- On Tue, 5/1/10, Jonathan Scott Duff <perlpi...@gmail.com> wrote: > >> From: Jonathan Scott Duff <perlpi...@gmail.com> > >> I'd imagine that the functionality will fall >> out of the ability to have nice failures because surely >> something like the following works now: >> >> subset Filename of Str where { $_ ~~ :f or >> fail "No such file: '$_'" } >> Perhaps s/fail/die/, but that seems like a means >> to your desired end. > > Ah, the die works fine. However, "fail" causes that sub call to be skipped > altogether: > > subset Filename of Str where { $_ ~~ :f or fail "$_ is not a filename" }; > > sub foo (Filename $name) { > say "Houston, we have a filename: $name"; > } > > foo($*EXECUTABLE_NAME); > say "before"; > foo('no_such_file'); > say "after"; > > Output: > > Houston, we have a filename: /Users/ovid/bin/perl6 > before > after > > Is this a bug or just documented behavior that I don't know about?
fail just returns an uncalled exception. What does that do in a where block? -- Solomon Foster: colo...@gmail.com HarmonyWare, Inc: http://www.harmonyware.com