[Openmcl-devel] [CLSQL] Slime, CLSQL, and reader macros
patrick.may at mac.com
Thu Apr 1 18:59:22 UTC 2010
[ Adding OpenMCL-devel, since CCL seems to be involved somehow in this problem. ]
On Apr 1, 2010, at 10:32 AM, Nathan Bird wrote:
> On 4/1/2010 9:41 AM, Patrick May wrote:
>> 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.
Interesting. I tried this with SBCL and it worked. Why would ccl64 behave differently? (Code below.)
(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
Url : http://clozure.com/pipermail/openmcl-devel/attachments/20100401/c338728d/attachment.bin
More information about the Openmcl-devel