Black Hole's in Hugs?

Alastair Reid reid@cs.utah.edu
Wed, 11 Apr 2001 16:40:23 -0600


> The concrete question is: What does {_Gc Black Hole} mean?

A black hole is a particular kind of cyclic definition such as:

  let a = a+1 in a

where the value of an expression depends on the value of that same expression.

They are a special kind of infinite loop which, it turns out, a garbage
collector is able to detect.  When the GC detects such loops, it overwrites
the thunk with the _Gc Black Hole value and Hugs can report an error instead
of just grinding forever.  

For that to happen, the GC must run - obviously
your example doesn't allocate (or use stack space) each time round the loop
or does so very, very slowly so it doesn't get detected.  But then you hit
ctrl-C and Hugs runs the garbage collector (and detects the loop) before 
evaluating the next command and so Hugs detects the error on the second 
evaluation.

Hmmm, I can see why the error message puzzled you - perhaps we should
change the message?  {Infinite Loop} is the best I can come up with.

--
Alastair Reid