Type BOOLEAN

Edi Weitz <[email protected]>
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
With the attached patch CLSQL is more "liberal" about boolean data
types. Suppose you have a class defined like this:

  (def-view-class foo ()
    ((a :initarg :a
        :type boolean)))

If you do, say,

  (make-instance 'foo :a (find item seq))

then current CLSQL will raise an error because the result of FIND is
most likely neither T nor NIL. I think it's more Lisp-y to allow for
generalized booleans in this case. It's just that the docs should make
clear that reloading these instances from the SQL database will give
you T or NIL and nothing else.

Any objections?

Cheers,
Edi.

_______________________________________________
CLSQL-Devel mailing list
[email protected]
http://lists.b9.com/mailman/listinfo/clsql-devel
oodml.patch (text/x-patch, 550 B)
--- oodml.lisp.orig	2004-06-09 01:31:16.000000000 +0200
+++ oodml.lisp	2004-06-09 01:29:01.000000000 +0200
@@ -142,7 +142,8 @@ (defun check-slot-type (slotdef val)
   (let* ((slot-type (specified-type slotdef))
          (basetype (if (listp slot-type) (car slot-type) slot-type)))
     (when (and slot-type val)
-      (unless (typep val basetype)
+      (unless (or (eq basetype 'boolean)
+                  (typep val basetype))
         (error 'sql-user-error
 	       :message
 	       (format nil "Invalid value ~A in slot ~A, not of type ~A."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.