[rucksack-devel] slot-index

Takehiko Abe keke at gol.com
Wed Mar 14 09:33:12 UTC 2007


I think it would be nicer if rucksack signals error for me
when I give an imcompatible value to a slot with a index.
(e.g. giving string to :symbol-index.)

Adding :key-type to index-spec definitions seems to accomplish
it. But I'm not sure this is right.

What do you think?

regards,
T.



Index: index.lisp
===================================================================
RCS file: /project/rucksack/cvsroot/rucksack/index.lisp,v
retrieving revision 1.9
diff -u -r1.9 index.lisp
--- index.lisp	20 Jan 2007 18:17:55 -0000	1.9
+++ index.lisp	14 Mar 2007 08:41:58 -0000
@@ -193,20 +193,21 @@
 (eval-when (:compile-toplevel :load-toplevel :execute)
 
   (define-index-spec :number-index
-                     '(btree :key< < :value= p-eql))
+                     '(btree :key< < :value= p-eql :key-type number))
 
   (define-index-spec :string-index
-                     '(btree :key< string< :value p-eql))
+                     '(btree :key< string< :value p-eql :key-type string))
 
   (define-index-spec :symbol-index
-                     '(btree :key< string< :value p-eql))
+                     '(btree :key< string< :value p-eql :key-type symbol))
 
   (define-index-spec :case-insensitive-string-index
-                     '(btree :key< string-lessp :value p-eql))
+                     '(btree :key< string-lessp :value p-eql :key-type
string))
 
   (define-index-spec :trimmed-string-index
                      ;; Like :STRING-INDEX, but with whitespace trimmed left
                      ;; and right.
                      '(btree :key< string<
                              :key-key trim-whitespace
-                             :value p-eql)))
+                             :value p-eql
+                             :key-type string)))





More information about the rucksack-devel mailing list