[slime-devel] [CLSQL] Slime, CLSQL, and reader macros
Nathan Bird
nathan at acceleration.net
Thu Apr 1 14:32:07 UTC 2010
On 4/1/2010 9:41 AM, Patrick May wrote:
> This is a follow up to a question I asked recently on the CLSQL list. I think the problem is my mental model of Slime.
>
> My environment is OS X 10.6.3, Clozure 1.3-r12755M, PostgreSQL 8.4.1, and CLSQL 5.0.5.
>
> My problem is with the CLSQL square bracket syntax in Slime. If I run the code below from a REPL started at the command line, it works fine. I can use either the file-enable-sql-reader-syntax or the locally-enable-sql-reader-syntax / restore-sql-reader-syntax-state pair fine. When I evaluate the same code in Slime with C-x C-e or C-c C-r, however, I get this error when defining add-customer:
>
> ;Compiler warnings :
> ; In ADD-CUSTOMER: Undeclared free variable [=
> ; In ADD-CUSTOMER: Undeclared free variable [ID]
> ; In ADD-CUSTOMER: Undeclared free variable ID]
>
> and this error when trying to add a customer object:
>
> Unbound variable: [=
> [Condition of type UNBOUND-VARIABLE]
>
> This happens with either way of enabling the square bracket syntax.
>
> Am I misunderstanding something fundamental about Slime? Has anyone managed to use Slime for CLSQL development with the square bracket syntax?
I've only really worked with SBCL so there might be something different
in the implementations, but yes the square bracket reader syntax works
fine for me under slime.
Here's some more data that may help you with your model
* Slime compiles some things with (eval (read "your code here")) e.g.
the REPL does this and most of the 'Evaluation' commands that start with
C-x;
* Slime compiles some stuff with compile-file-- simple case is C-c C-k--
but sometimes it copies a region from emacs into a temporary file, and
then calls compile-file on that -- most compilation commands that start
with C-c probably do this.
* According to the spec any modifications to the binding of *readtable*
should be undone by the impl after it finishes COMPILE-FILE or LOADing a
resource. There is no such restriction for eval. ALL of the clsql
macros effect the binding leaving the previous readtable intact for when
the impl restores it.
My standard workflow:
* Every file that needs it has (file-enable...)
1. load a project with asdf under slime
2. hack, at some point I go to redefine a function with C-c C-c, get the
syntax error
3. go to the top of the file, evaluate the file-enable with C-x C-e
* at this point, the *readtable* variable is permanently modified to
point to a readtable that includes the [] syntax, there are no
references to the old readtable.
If i were to need to undo that I would need another function that sets
for those characters, or to restart my lisp. This just about never comes
up for me.
Hope that helps!
--
Nathan Bird
nathan at acceleration.net
http://www.acceleration.net/
Custom Programming, Design, Hosting, and Broadband.
More information about the slime-devel
mailing list