On Wed, Oct 16, 2002 at 02:54:37AM +1000, Ken Williams wrote:
> 
> On Tuesday, October 15, 2002, at 07:05  AM, Michael G Schwern wrote:
> > This came up at YAPC::Europe.  Someone [1] wanted to know if 1/0 would
> > produce a divide by zero error in Perl 6, or if it would return a value
> > representing an indeterminate result (undef?)  It would make more sense 
> > for
> > Perl, upon being given a simple bit of impossible math, to return undef
> > (like other functions do on failure) than to generate an error.  The 
> > error
> > seems a throwback to earlier days of hardwired calculators.
> 
> Well, if you're an exceptions guy like me, you'd *much* rather have it 
> produce an error than a zero, which I assume undef would still evaluate 
> to.

People have used the terms "error" and "exception" interchangably in
this disucssion.  To me, an "error" is something that stops program
execution while an "exception" may or may not stop execution depending
on what the user decides to do about exceptions.

1/0 could throw an exception, yet continue execution.  Somewhere I
expect we should be able to define a policy for what to do in these
situations.

        use Policy DivideByZero => Nan;
        use Policy DivideByZero => Inf;
        use Policy DivideByZero => DivideByZeroException;

I'm sure someone else can pick a better syntax than I.

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to