emacs-devel
[Top][All Lists]
Advanced

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

Re: bizarre byte-compile issue, possibly due to EIEIO


From: David Engster
Subject: Re: bizarre byte-compile issue, possibly due to EIEIO
Date: Tue, 05 Apr 2011 18:38:23 +0200
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux)

Ted Zlatanov writes:
> On Mon, 04 Apr 2011 17:34:10 +0200 David Engster <address@hidden> wrote: 
>
> DE> I wasn't thinking. The constructor has to check if there was an initarg
> DE> provided for 'data', otherwise it will overwrite it. Hence you have to
> DE> use something like
>
> DE>  (defmethod initialize-instance :after ((this registry-db) slots)
> DE>    "Set value of data slot of THIS after initialization."
> DE>    ;; 'data' will already be set if read from file, so don't overwrite it.
> DE>    (with-slots (data tracker) this
> DE>      (unless (member :data slots)
> DE>        (setq data (make-hash-table :size 10000 :rehash-size 2.0 :test 
> 'equal)))
> DE>      (unless (member :tracker slots)
> DE>        (setq tracker (make-hash-table :size 100 :rehash-size 2.0)))))
>
> DE> This is also why you shouldn't set the other slot values here.

[...]

> I took your advice on both the constructor and the type.  The updates
> plus some bug fixes are pushed.  I'll test it a bit and if it works OK
> will merge the "tzz-gnus-registry-rewrite" branch into "master".

I saw that you now set every slot value in the :after method. This isn't
necessary; :initform is absolutely save to use for symbols. The only
thing that changed in EIEIO is for the case where :initform is a
function which has to be evaluated, which is only working correctly in
newer versions.

-David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]