[Ecls-list] “Cannot find the external symbol...” convenience restart

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Sun Sep 14 14:17:39 UTC 2008


On Sun, Sep 14, 2008 at 3:44 PM, Leslie P. Polzer
<sky at viridian-project.de>wrote:

>
> > There is a problem with this which is not related to the internal /
> external
> > problem and which is that if the debugger jumps in when the reader is
> > working, then all the input is trashed.
>
> Isn't that the real problem? Shouldn't the debugger allocate
> a new input buffer for itself?


ECL does not do its own buffering. For better cooperation with the C world,
this is done by the C streams which underly all Lisp stream objects.

But that is not the point. Even if we could allocate a new buffer, it would
be just a hack: for the debugger would not only need to allocate a new
buffer, it would first have to force the input stream to buffer all
remaining lines (*) and only then expect user input. That requires low level
knowledge of the input stream and would prevent user from replacing
*standard-input* with any other CLOS stream, such as ecl-readline.

I am thinking about multiple lines because that is the way emacs interacts
with the lisp: it sends several lines of input at the time. If the error is
at the beginning of a line and the debugger just pops in, it will see lots
of lines with garbage, but which is needed for useful recovery after we
return from the debugger.

CLISP (see below), does not provide that restart. Input is discarded and
debugger may properly warn the user and return. SBCL does provide the
restart, but in the multiline case it is just confusing for it now expects
further input and it is not even clear _where_ the required input begins to
apply: end of line? why? why not just after the offending symbol?

The only solution to the problem would be to allocate a new C stream that
points to a different tty or window and interacts with the user.

Juanjo

--example 1 : CLISP --
Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2008

Type :h and hit Enter for context help.

[1]> '(1 cl-user:foo
2
3 4)

*** - READ from
       #<INPUT CONCATENATED-STREAM #<INPUT STRING-INPUT-STREAM>
         #<IO TERMINAL-STREAM>>
      : #<PACKAGE COMMON-LISP-USER> has no external symbol with name "FOO"
The following restarts are available:
ABORT          :R1      Abort main loop
Break 1 [2]> :R1
[3]>
Bye.
$


--example 2 : SBCL --

$ sbcl
This is SBCL 1.0.10, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* '(1 cl-user:foo
2
3 4 5)

debugger invoked on a SB-INT:SIMPLE-READER-PACKAGE-ERROR:
  SB-INT:SIMPLE-READER-PACKAGE-ERROR at 387 on #<SYNONYM-STREAM :SYMBOL
SB-SYS:\
*STDIN* {100BC7E9}>:
    Symbol "FOO" not found in the COMMON-LISP-USER package.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Use symbol anyway.
  1: [ABORT   ] Exit debugger, returning to top level.

(SB-IMPL::READ-TOKEN #<SYNONYM-STREAM :SYMBOL SB-SYS:*STDIN* {100BC7E9}>
#\c)
0] 0
4 6)

(1 FOO 2 4 6)


-- 
Instituto de Física Fundamental
CSIC, Serrano, 113, Madrid 28040 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20080914/16700fd8/attachment.html>


More information about the ecl-devel mailing list