[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Not a bug!
- To: GRAND at MIT-MC
- Subject: Not a bug!
- From: Robert W. Kerns <RWK at MIT-MC>
- Date: Sat, 22 Sep 79 15:46:00 GMT
- Cc: BUG-LISP at MIT-MC
- Original-date: 22 September 1979 11:46-EDT
From: Date:
Date: Fri, 22 Sep 79 13:48:25 GMT
Original-Date: 09/22/79 09:48:25 EDT
Subject:
From: GRAND at MIT-AI
To: (BUG LISP) at MIT-AI
I regret to report a bug in lisp. I was trying to get a
program of mine to locally use the default symbol table when I
found out that (PROG (READTABLE)(ARRAY READTABLE READTABLE T))
modifies the top level readtable and leaves the readtable in the
prog bound to nil. Please advise me on the resolution of this
problem and/or a way to circumvent it.^J ^J -- Mark Grand
As JONL told you a few days ago, this is *NOT* a bug. You are doing
very much the wrong thing. Let me try again to explain:
Doing (PROGN (x) ....) binds x to NIL. This is it's defined behaviour.
First off, I'd recommend against your using PROG at all. It is usually not the
right thing, being designed for doing things in a Fortran-like manner, with
GO's etc. It is ALWAYS wrong to PROG-bind something for which NIL is not a
legal value, such as READTABLE. Instead, you should Lambda-bind it (using
the LET construct) to a new readtable. The way you create a new readtable is
(ARRAY () READTABLE T). The object is not to put an ARRAY property on the
symbol READTABLE (as your "(ARRAY READTABLE READTABLE T)" does) but to bind
the symbol READTABLE to a new readtable.
However, you probably do NOT want to create a new readtable every time you
do whatever it is you're doing. So probably the right thing for you to do
is to create your readtable once, at load-time. I.e. put in your file the
following top-level form.
(LET ((READTABLE (ARRAY () READTABLE T)))
(SETQ MY-READTABLE READTABLE) ; So we can use this latter
(SETSYNTAX .....)) ; Do whatever modifications we want
Then, when you want to read with this modified readtable, just do
(LET ((READTABLE MY-READTABLE))
<whatever you want to do with this readtable>)
If you need help with the LET syntax, let me know.