[slime-devel] Slime, CLSQL, and reader macros
patrick.may at mac.com
Thu Apr 1 13:41:02 UTC 2010
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?
(def-view-class customer ()
((id :db-kind :key
(name :db-constraints :not-null
(phone-number :db-constraints :not-null
(defconstant +id-sequence+ "id_sequence")
(defun add-customer (name phone-number)
"Add a customer."
(let ((id (sequence-next +id-sequence+)))
(first (select 'customer :where [= [id] id] :flatp t))))
(connect '("localhost" "db-name" "user" "password")
(defparameter customer-foo (add-customer "Test Customer Foo" "0123456789"))
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2421 bytes
Desc: not available
More information about the slime-devel