unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Support virtual slots in EIEIO
@ 2018-11-21  5:33 Yuan Fu
  2018-11-21 14:50 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Yuan Fu @ 2018-11-21  5:33 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1128 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2660 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-21 14:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-21  5:33 Support virtual slots in EIEIO Yuan Fu
2018-11-21 14:50 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).