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

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



David Engster writes:

>> But we seem to have no smart solution so far, except for a workaround.
>> That is, Arisawa-san provided the `shimbun-rss-initialize-ignored-subject'
>> function and modified sb-itmedia.el and sb-opentechpress-jp.el so as to
>> use it in the `initialize-instance' method as follows:
> 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.

luna-define-internal-accessors で定義されたアクセサは、多重継承された
クラスのオブジェクトに対しては、期待通りに動かないのですね…。

(require 'luna)
(luna-define-class myparent1 () (slot1) )
(luna-define-internal-accessors 'myparent1)
(luna-define-class myparent2 () (slot2) )
(luna-define-internal-accessors 'myparent2)
(luna-define-class newclass (myparent1 myparent2) ())

(setq x (luna-make-entity 'newclass :slot1 1 :slot2 2))
 => [newclass [0 0 0 0 0 0 0] 1 2]
(myparent1-slot1-internal x)
 => 1
(myparent2-slot2-internal x)
 => 1

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

コンストラクタのことといい、どうにも luna で多重継承はよろしくない感じで
すね。週末にでももうちょっと調べてみますが、良いアイデアがあればおしらせ
ください。

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

-- 
有沢 明宏