[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: Problem with sb-rss-hash (bug in luna?)



ARISAWA Akihiro <ari@xxxxxxxxxxxxx> writes:
>> Unfortunately, this approach does not work with sb-rss-hash. The reason
>> for this is that in contrast to sb-multi, the sb-hash class defines a
>> new slot 'content-hash', which collides with the 'ignored-subject' slot
>> from sb-rss. If you call shimbun-rss-initialize-ignored-subject
>> explicitly from sb-rss-hash, it effectively overwrites the content-hash
>> slot.

[...]

> macroexpand してみると、、、
> (macroexpand '(myparent1-slot1-internal x))
>  => (aref x 2)
> (macroexpand '(myparent2-slot2-internal x))
>  => (aref x 2)

[...]

> なお、luna-slot-value だと期待通りに取得できたので、とりあえずはこれに変
> えるという回避策はありそうです。
> (luna-slot-value x 'slot1)
>  => 1
> (luna-slot-value x 'slot2)
>  => 2

(I had to read your mail via Babelfish, so please forgive me if I'm
understanding you wrong.)

The problem is indeed that the 'myparent-slot-internal' functions are
defined as static macros, while 'luna-slot-value' determines the correct
slot index at runtime, which is slower but needed for inheritance. One
could simply use these functions instead of the static macros, for
example with the following patch (against luna.el from flim 1.14.9):

--8<---------------cut here---------------start------------->8---
--- luna.el	2005-07-06 04:09:04.000000000 +0200
+++ ../emacs-packages/flim/luna.el	2009-03-24 18:21:53.000000000 +0100
@@ -390,19 +390,14 @@
 	       (setq parents (cdr parents)))
 	     (eval
 	      `(progn
-		 (defmacro ,(intern (format "%s-%s-internal"
+		 (defsubst ,(intern (format "%s-%s-internal"
 					    class-name slot))
 		   (entity)
-		   (list 'aref entity
-			 ,(luna-class-slot-index entity-class
-						 (intern (symbol-name slot)))))
-		 (defmacro ,(intern (format "%s-set-%s-internal"
+		   (luna-slot-value entity ',slot))
+		 (defsubst ,(intern (format "%s-set-%s-internal"
 					    class-name slot))
 		   (entity value)
-		   (list 'aset entity
-			 ,(luna-class-slot-index
-			   entity-class (intern (symbol-name slot)))
-			 value)))))))
+		   (luna-set-slot-value entity ',slot value)))))))
      (luna-class-obarray entity-class))))
--8<---------------cut here---------------end--------------->8---

Regards,
David