emacs-devel
[Top][All Lists]
Advanced

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

Support virtual slots in EIEIO


From: Yuan Fu
Subject: Support virtual slots in EIEIO
Date: Wed, 21 Nov 2018 00:33:34 -0500

I'm working on a project that uses EIEIO. At some point, I need to declare a virtual slot — one
that has a getter and a setter. Because EIEIO doesn't support it, I tried to hack one by myself.

I overloaded slot accessor and (setf slot-accessor). Then some problem arises:
1. initial arguments don't work, that's what I expected anyway and I can work around that.
2. I couldn't overload `set-slot-value' and `slot-value' because they are just aliases to `eieio-oset`
   and `eieio-oref', which are functions. That, I can't work around (or I think I can't?)

So, is there any possible workaround that can make `set-slot-value'
and `slot-value' work with my virtual slot hack? All I can do right now is write something like "never
use these two functions with this slot!!!" in the documentation.

That being said, are you interested in adding virtual slots to EIEIO?
My naive approach would be make `eieio-oset' and `eieio-oref' generic functions.
But I don't really know anything about EIEIO and Emacs
so I don't know how much impact will that give, except everything in
EIEIO becoming slower.

Yuan

reply via email to

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