Subject: [clisp-list] assert goes into an endless loop

From: Bruno Haible <[email-masked]>
Date: Wed Apr 17 08:05:32 2002

With clisp-2.26,

$ clisp -x '(assert (>= -1 0))'

goes into an endless loop. This makes it very risky to use ASSERT in batch
mode scripts. It'd better for the script to abort in such a case, instead of
going into an endless loop.

Bruno

---

From: Will Newton <[email-masked]>
Date: Wed Apr 17 08:55:10 2002

> With clisp-2.26,

Is this fixed in the latest versions?

---

From: Sam Steingold <[email-masked]>
Date: Sun Apr 21 10:07:01 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] assert goes into an endless loop"
> * Sent on Wed, 17 Apr 2002 16:35:42 +0200 (CEST)
> * Honorable Bruno Haible <[email-masked]> writes:
>
> With clisp-2.26,
> 
> goes into an endless loop.

arguably, this is similar to '(loop)' :-)

BTW, why does CLISP use invoke-restart (instead of
invoke-restart-interactively) in appease-cerror?
this breaks things like '(appease-cerrors (assert x (x)))'.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
<http://www.palestine-central.com/> <http://www.mideasttruth.com/>
Profanity is the one language all programmers know best.

---

From: Sam Steingold <[email-masked]>
Date: Mon Apr 22 09:09:10 2002

> goes into an endless loop.

this is fixed in the CVS now.

> This makes it very risky to use ASSERT in batch mode scripts.

you don't want to use ASSERT in batch scripts.
ASSERT is an interactive idiom.

> It'd better for the script to abort in such a case, instead of going
> into an endless loop.

actually, I would argue that it is better to invoke an interactive
debugger in such a situation, at least in some cases.

Right now CLISP will go into batch mode with -c and -x and exec
options, thus preventing ASSERT loops.
I think this should be optional -- e.g., an -interactive or -no-batch
option should override this batch mode.
what do you think?

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
<http://www.palestine-central.com/> <http://www.mideasttruth.com/>
Small languages require big programs, large languages enable small programs.

---

From: Bruno Haible <[email-masked]>
Date: Mon Apr 22 09:47:18 2002

> this is fixed in the CVS now.

Thank you.

> ASSERT is an interactive idiom.

If you say ASSERT is interactive, then CHECK-TYPE, CCASE, CTYPECASE
etc would also be "interactive" and forbidden in batch scripts.

But this is against one of the principles of the CL condition system.
Namely, the separation between the code which signals an exception and
the code which handles it. The idea behind this separation is to reuse
some code from a non-interactive application in an interactive
application, and vice versa, without changing the code. Only the
top-level signal handlers differ between the two kinds of
applications, and this should be enough to implement the distinction
between the interactive and non-interactive case.

> ...
> e.g., an -interactive or -no-batch

There are indeed cases where one wants to debug non-interactive
scripts. A -interactive-debug option would be useful for this case.
But by default, -x and exec options should be non-interactive, IMO.

Bruno

---

From: [email-masked] (Don Cohen)
Date: Mon Apr 22 10:00:02 2002

Is the problem that continuable errors are continued in batch mode?
It does seem useful to continue past some such errors in that case.
Perhaps there could be a limited number of such continues?  In fact
it might be useful to specify the limit in a batch program.

---

From: Sam Steingold <[email-masked]>
Date: Mon Apr 22 10:12:06 2002

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] assert goes into an endless loop"
> * Sent on Mon, 22 Apr 2002 18:33:07 +0200 (CEST)

okay, let it be `-interactive-debug' (long but clear, the CL way :-)

BTW, ASSERT and CHECK-TYPE use PROMPT-FOR-NEW-VALUE which goes through
*QUERY-IO* and not *DEBUG-IO*.  Are you sure this is correct?
(I bet it's a typo :-)

> But by default, -x and exec options should be non-interactive, IMO.
of course (-c is there too!)

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
<http://www.palestine-central.com/> <http://www.mideasttruth.com/>
((lambda (x) (list x (list 'quote x))) '(lambda (x) (list x (list 'quote x))))