Re: Custom errors on subsets?

2010-01-05 Thread Ovid
--- On Tue, 5/1/10, Jonathan Scott Duff wrote: > From: Jonathan Scott Duff > 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: '

Re: Custom errors on subsets?

2010-01-05 Thread Solomon Foster
On Tue, Jan 5, 2010 at 11:18 AM, Ovid wrote: > --- On Tue, 5/1/10, Jonathan Scott Duff wrote: > >> From: Jonathan Scott Duff > >> 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 Filen

Re: Custom errors on subsets?

2010-01-05 Thread Ovid
--- On Tue, 5/1/10, Solomon Foster wrote: > From: Solomon Foster > > 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? I knew it returned an uncalled exception, but I'm still not expecting t

Re: Custom errors on subsets?

2010-01-05 Thread Solomon Foster
On Tue, Jan 5, 2010 at 11:36 AM, Ovid wrote: > --- On Tue, 5/1/10, Solomon Foster wrote: > >> From: Solomon Foster > >> > 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? > > I knew it ret

Re: Custom errors on subsets?

2010-01-05 Thread Larry Wall
On Tue, Jan 05, 2010 at 11:52:42AM -0500, Solomon Foster wrote: : On Tue, Jan 5, 2010 at 11:36 AM, Ovid : wrote: : > --- On Tue, 5/1/10, Solomon Foster wrote: : > : >> From: Solomon Foster : > : >> > Is this a bug or just documented behavior that I don't : >> know about? : >> : >> fail just retu

[perl #71846] currying of prefix: operator with !whatever_closure

2010-01-05 Thread Dave Whipp
# New Ticket Created by "Dave Whipp" # Please include the string: [perl #71846] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=71846 > By principle of least surprise, all three of these should result in the same output: r

Re: Custom errors on subsets?

2010-01-05 Thread Jonathan Scott Duff
On Tue, Jan 5, 2010 at 1:07 AM, Ovid wrote: > --- On Mon, 4/1/10, yary wrote: > > > From: yary > > > 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 t

Re: Custom errors on subsets?

2010-01-05 Thread Jon Lang
Perhaps you could create an error function that temporarily sets the default error message (does perl 6 still have the $! variable?) and returns false; so: subset Filename of Str where { $_ ~~ :f or error ( "No such file: '$_'" ) } Of course, that's a rather narrowly-defined function, as it's

Re: Custom errors on subsets?

2010-01-05 Thread John Harrison
Would it make sense to have the failure bound to the function parameter rather than the subset? eg.: sub foo (Str $name where { $_ ~~ :f } else { die "Houston, we don't have a file" } ) { ... } Just a thought... On Tue, Jan 5, 2010 at 1:07 AM, Ovid wrote: > --- On Mon, 4/1/10, yary wrote: > >