[Openmcl-devel] [CLSQL] Slime, CLSQL, and reader macros

Gary Byers gb at clozure.com
Thu Apr 1 18:22:05 UTC 2010


Without knowing what (FILE-ENABLE-SQL-READER-SYNTAX) does, how would anyone
know what the problem is ?  (I can guess that it tries to enable some reader
macros, but I don't know how it tries to do that.)

If whatever the problem is might be a bug in CCL 1.3, have you tried 1.4 to see
if the problem persists ?

On Thu, 1 Apr 2010, Patrick May wrote:

> [ 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.)
>
> Thanks,
>
> Patrick
>
> (in-package :common-lisp-user)
>
> (defpackage :clsql-testing
> (:use :common-lisp
>       :clsql))
>
> (in-package :clsql-testing)
>
> (file-enable-sql-reader-syntax)
>
> ;(locally-enable-sql-reader-syntax)
>
> (def-view-class customer ()
> ((id :db-kind :key
>      :db-constraints :not-null
>      :initarg :id
>      :reader id
>      :type integer)
>  (name :db-constraints :not-null
>        :initarg :name
>        :reader name
>        :type string)
>  (phone-number :db-constraints :not-null
>                :initarg :phone-number
>                :accessor phone-number
>                :type string))
> (:base-table "test_customer"))
>
> (defconstant +id-sequence+ "id_sequence")
>
> (defun add-customer (name phone-number)
> "Add a customer."
> (let ((id (sequence-next +id-sequence+)))
>   (update-records-from-instance
>    (make-instance 'customer
>                   :id id
>                   :name name
>                   :phone-number phone-number))
>   (first (select 'customer :where [= [id] id] :flatp t))))
>
> (connect '("localhost" "db-name" "user" "password")
>        :database-type :postgresql-socket
>        :if-exists :new
>        :pool t)
>
> (defparameter customer-foo (add-customer "Test Customer Foo" "0123456789"))
> (id customer-foo)
>
> ;(restore-sql-reader-syntax-state)
> (disconnect-pooled)
>
>



More information about the Openmcl-devel mailing list