Mark J. Reed wrote:
> I realize the above is mathematically simplistic.  The
> real reason y = x/0 returns an error is because no matter what
> value you assign to y, you aren't going to get x back via multiplying
> y by 0.

Well, that may be true in math; but there's no reason why it has to be
true in Perl6 (using the Math::Perverse module?)

Imagine

 > $b = 7 / 0

.... $b = undef but DivZero(7) but Overload('*' => sub ($rhs) { $rhs==0 ? 7 :
.... })

 > print $b * 0

.... "7"

 > print $b * 2 * 0

.... "14"


I.e. you can use a runtime property to remember the value that was
divided by zero. I'm not sure what the correct syntax is to make that
really clean: hopefully the DivZero property could do the Overload.


Dave.

Reply via email to