[Openmcl-devel] *readtable* and break loop

Gary Byers gb at clozure.com
Thu Sep 19 05:17:58 UTC 2002



On Wed, 18 Sep 2002, Ben Hyde wrote:

>
> Should ccl::break-loop bind *readtable* to %initial-readtable% ?

%INITIAL-READTABLE% is supposed to be a prototype that's hard to
get one's hands on (and accidentally modify.)  If the break loop
wants to bind *READTABLE* to something known and sane, it should
probably bind it to a copy.

There's a little bit of a protocol for trying to ensure that
special variables have sane values on entry to a break loop:

? (setq *package* "CCL")  ; I've done this, I'm sure
"CCL"
?
> Error: value "CCL" is not of the expected type PACKAGE.
> While executing: CCL::ENSURE-VALUE-OF-TYPE
;  NOTE: *PACKAGE* was "CCL", was reset to #<Package "COMMON-LISP-USER"> .
> Type :POP to abort.
Type :? for other options.
1 > :pop
? *package*
#<Package "COMMON-LISP-USER">
?

That protocol doesn't help much in cases like:
? (let* ((*package* (find-package "KEYWORD")))
    (break))
> Break:
> While executing: #<Anonymous Function #x525F42E>
> Type :GO to continue, :POP to abort.
> If continued: Return from BREAK.
Type :? for other options.
1 > (list 1 2 3)
> Error: Undefined function :LIST called with arguments (1 2 3) .
> While executing: "Unknown"
> Type :GO to continue, :POP to abort.
> If continued: Retry applying :LIST to (1 2 3).
Type :? for other options.

e.g., you'd sort of like to ensure that:

  a) on entry to the break loop, *PACKAGE* is a package (and try to
     set it to something that -is- if it isn't.)
  b) within the break loop, *PACKAGE* is bound to a package that
     makes it convenient to type lisp expressions (a package that
     inherits from the CL package, at least.)

OpenMCL does (a) but not (b); just binding *PACKAGE* to itself
around the break loop would probably be an improvement over the
status quo.

(b) should probably be implemented something like:

  (let* (( ... ...)
         (*package* *package*)
         (... ...))
    (unless (package-inherits-from-cl-package-p *package*)
      (setq *package* (some-package-that-inherits-from-cl-package))
      (tell-user-package-was-changed-for-their-own-good-within-break-loop))
    ...)

I'm tempted to think that *READTABLE* should be handled analogously.

? (ccl::check-error-global '*readtable* 		        ; special var
                           #'(lambda (x) (typep x 'readtable))  ; sanity check
                           #'(lambda () (copy-readtable nil)))  ; "sane" value


, bound to itself around the break loop, then set to something sane
if it doesn't have standard definitions for #\(, #\', #\", ... .

CCL::CHECK-ERROR-GLOBAL isn't incredibly robust; if you do:

? (makunbound '*package*)

you probably deserve whatever happens ...

> While it's amusing for a moment or two to discover that #\: has
> been given a unique semantics in the break loop you've just
> fallen into the joke get's old quickly.

As I've gotten older, I've noticed that people will start laughing
during a conversation; while I'm waiting for a response to the
serious issues I've raised, they'll slap me on the shoulder, accuse
me of having an extremely dry sense of humor, and keep laughing.

Usually when this happpens, I'm too embarrassed to admit this, but
I'll try to overcome that this time.  Could you please explain the
joke in some detail ?  (I honestly don't get the part about the
semantics of #\: changing ...)



>
>  - ben
>
> --
> http://enthusiasm.cozy.org/
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel
>
>


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel




More information about the Openmcl-devel mailing list