[darcs-users] Re: Darcs record hangs

Donald Bruce Stewart dons at cse.unsw.edu.au
Mon Mar 15 00:55:43 UTC 2004

> [let me know if you want to be snipped from CCs]
> > I'm not sure it is actually an infinite loop. Such a thing can be
> > detected by the runtime system, which will generate an exception:
> >
> >         Prelude> let f = f
> >         Prelude> f
> >         *** Exception: <<loop>>
> The RTS isn't magic. It can detect "black-holes" of that nature, but not
> things like
> Prelude> let f n = f (n+1)
> Prelude> f 0
> (this literally is the famous "halting problem", and you can't in general
> tell whether something is infinite looping or just running for a very long
> time).

Oops. Time for some coffee ;) 

Of course, the closure for

        let f = f

can be black-holed (you can mark it as in the process of being
evaluated, and get a surprise when you reenter it when trying to
determine its value), whereas:

        let g = \n -> g (n+1)

is entirely different. You can enter g and update it with a pointer to a
thunk for g (n+1). 

Anyway, I think I'm just trying to be sceptical of infinite loops in
darcs, as most error reports seem to be actually related to performance ;)


More information about the darcs-users mailing list