"Leslie P. Polzer" <[email protected]> writes:

> This looks very much like an SBCL bug. Can you report it to the SBCL
> mailing list for now?

Sure! I'll send a bug report ASAP.

Btw, Thinking more about this patch, I think it's a buggy approach.

Consider the situation (not that uncommon) in which an id for an object
is its hierarchical code (for example "1.2.3").

This type of codes are sometimes useful when representing simple
hierarchies like this:

1      parent
1.1    child
1.1.1  child
2      another parent
2.1    another child

With this patch, codes like "1.1.1" will be considered strings, while
codes like "1" or "2" will be converted to integers, causing type errors
in the upper levels of the program.

What do you think about the alternative patch attached here?

Bye,
Andrea.

P.S. This new patch has the bonus of not exposing the supposed sbcl bug.

-- 
Software vuol dire conoscenza! Per questo dev'essere un bene comune!
Usa software libero e contribisci a cambiare il mondo:
http://www.softwarelibero.it
http://www.fsf.org
http://www.gnu.org

-- 
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en.

# HG changeset patch
# User Andrea Russo <[email protected]>
# Date 1309353854 -7200
# Node ID 129a92f0b4e9acf36806e257c0b7f1de05843be7
# Parent  dde87661f2512dce4b5fc51ca1b9bac308102722
Don't assume tha object ids are always integers in ``dataseq-operations-action''.

diff -r dde87661f251 -r 129a92f0b4e9 src/widgets/dataseq/operations-action.lisp
--- a/src/widgets/dataseq/operations-action.lisp	Mon Jun 27 16:09:43 2011 +0200
+++ b/src/widgets/dataseq/operations-action.lisp	Wed Jun 29 15:24:14 2011 +0200
@@ -12,13 +12,19 @@
   (dataseq-clear-selection obj)
   (loop for i in (request-parameters)
      when (string-starts-with (car i) "item-")
-     do (dataseq-select-item obj (parse-integer (substring (car i) 5))))
+     do (let ((value (substring (car i) 5))
+              (type (closer-mop:slot-definition-type
+                     (mopu:get-slot-definition (dataseq-data-class obj)
+                                               (class-id-slot-name (dataseq-data-class obj))))))
+          (dataseq-select-item obj (case type
+                                     (string value)
+                                     (t (parse-integer value))))))
   (loop for i in (append
 		  (dataseq-item-ops obj)
 		  (dataseq-common-ops obj))
-        when (member (attributize-name (car i)) (request-parameters)
-                     :key (compose #'attributize-name #'car)
-                     :test #'string-equal)
-          do (funcall (cdr i) obj (dataseq-selection obj)))
+     when (member (attributize-name (car i)) (request-parameters)
+                  :key (compose #'attributize-name #'car)
+                  :test #'string-equal)
+     do (funcall (cdr i) obj (dataseq-selection obj)))
   (dataseq-clear-selection obj))
 

Reply via email to