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

From: lin8080 <[email-masked]>
Date: Tue Apr 23 13:02:59 2002

Hallo

>>>>> "lin8080" == lin8080  <[email-masked]> writes:

    lin8080> Claudio Bley schrieb:
    >>  "lin8080" == lin8080 <[email-masked]> writes:

    lin8080> With clisp-2.28 on win98:

    >> OK, but what about: clisp -x '(assert (>= -1 0))' ???

    >> On Linux i686, GNU CLISP 2.28 it indeed creates an endless
    >> loop:

    >> WARNING: (>= -1 0) must evaluate to a non-NIL value.  Retry
    >> WARNING: (>= -1 0) must evaluate to a non-NIL value.  Retry ...

    lin8080> Would you type in 100x Retry? 

.No, I wouldn't. I just wanted to point out that you did not do what
.Bruno asked for and of course obtained a different behavior. I don't
.know whether it is the same isssue Bruno was talking about as he said
."it creates an endless loop".

Aha. I show, what the interpreter does and this is ok, means the
interpreter find a correctable error and asks for instructions. I can't
guess, what Bruno means. But when assert returns in an interaction with
the user, it can't be used inside a list (the program will halt and
wait). What else will make assert to stop the interpreter? Should the
internals behind assert be modified?

    lin8080> How should the Interpreter react? 

.IMHO, if it is set in stone by the hyperspec that a "correctable"
.error is signalled there should be a chance to actually correct the
.error and the interpreter should wait for user input.

Yes, that is what happend. And the "test-form" given to assert can be
all kind of form (see HyperSpec). I think, the user is that one who has
responsible for what he does. So, someone can put a note to the
HyperSpec or the Impnotes. :)

.Otherwise if the interpreter is meant to be run in some sort of
.non-interaction mode the interpreter should signal the error and just
.exit without retrying to evaluate the test-form.

Hmm. Do you mean, the "correctable error" should be an normal "error"? I
can not find a function like "proof" or "examine", but find a makro
"check-type" or "ldb-test". Is there a equivalent to "assert"?

stefan

---

From: "Claudio Bley" <[email-masked]>
Date: Thu May 2 04:49:20 2002

>>>>> "lin8080" == lin8080  <[email-masked]> writes:

Hi,

(sorry for replying so late.)

    lin8080> .IMHO, if it is set in stone by the hyperspec that a
    lin8080> "correctable" .error is signalled there should be a
    lin8080> chance to actually correct the .error and the interpreter
    lin8080> should wait for user input.

    lin8080> Yes, that is what happend. 

Well, it didn't happen with clisp -x '(assert (>= -1 0))'. The
interpreter decided on itself to retry evaluating the test-form.

    lin8080> .Otherwise if the interpreter is meant to be run in some
    lin8080> sort of .non-interaction mode the interpreter should
    lin8080> signal the error and just .exit without retrying to
    lin8080> evaluate the test-form.

    lin8080> Hmm. Do you mean, the "correctable error" should be an
    lin8080> normal "error"? I can not find a function like "proof" or
    lin8080> "examine", but find a makro "check-type" or
    lin8080> "ldb-test". Is there a equivalent to "assert"?

This has been already changed as I proposed. 

clisp -x '(assert (>= -1 0))' with current CVS clisp yields:

*** - (>= -1 0) must evaluate to a non-NIL value.
Bye.

Additionally, there is a new option "-interactive-debug"; 
'clisp --help' says:

Actions:
 -c [-l] lispfile [-o outputfile] - compile LISPFILE
 -x expression - execute the expression, then exit
 lispfile [argument ...] - load lispfile, then exit
These actions put CLISP into a batch mode, which is overridden by
 -interactive-debug - allow interaction for failed ASSERT and friends
Default action is an interactive read-eval-print loop.

Claudio