[m-dev.] question about infinite recursion warnings

Peter Wang novalazy at gmail.com
Tue Apr 23 10:59:13 AEST 2019


On Sat, 20 Apr 2019 15:26:20 +1000 (AEST), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> Just before implementing Mantis 477 for Julien, I had a situation
> in which I could have used an infinite recursion warning but
> did not get one. It was a stock standard structural induction
> on a list, and as usual I copied-and-pasted the clause head
> to be the tail recursive call, but forgot to delete the list head,
> yielding code like this, which froze my machine for several
> minutes (before I could kill it) by running it out of memory:
> 
> p([X | Xs], !S) :-
>     ...,
>     p([X | Xs], !S).

On Linux, press Alt+SysRq+F to invoke the OOM killer
(assuming Magic SysRq is enabled).

> 
> Basically, my question boils down to: which is more annoying?
> Not getting an infinite recursion warning when you should,
> in situations resembling the one above, or getting one when
> you shouldn't?

Without having tried it, probably getting wrong warnings would be more
annoying. Perhaps such warnings should be opt-in, then the user cannot
complain about false positives.

Peter


More information about the developers mailing list