[plt-scheme] why should black holes be exceptions, rather than divergence?

From: Eli Barzilay (eli at barzilay.org)
Date: Mon May 31 10:36:29 EDT 2010

On May 31, Keiko Nakata wrote:
> More importantly I want to fully convince myself that "black holes
> as errors" is what I will want.
> 
> There are already discrepancies between Scheme, Haskell and Scala.
> There must be reasons why Scheme with its long history chose this
> implementation, which surely could be same as Robby's.

Actually, most Scheme implementations of delay/force will diverge in
that case.  The plt implementation of promises catches the error since
it makes it possible to do things more efficiently -- it sacrifices
being able to do such loops, but such loops need to use some state to
avoid diverging.  (In R5RS there is even an example that demonstrates
that.)

You can see how it's done (and why it's faster) in the reference
implementation of srfi-45.
-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.