From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: Support virtual slots in EIEIO
Date: Wed, 21 Nov 2018 09:50:57 -0500 [thread overview]
Message-ID: <jwv36rumr1d.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: CAO0xp5yyXKOvJB6kAYtdLXE0LEwCa1YJPz3Vxdf8j9EJKyqPDQ@mail.gmail.com
Hi,
> 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.
Very interesting. I'm not very familiar with this, so in order to see
what's the best solution, could you help me with some context:
- How does this work in CLOS (or in other systems that gave you the
idea of a virtual slot ;-)?
- Why do you need such a virtual slot (what alternatives have you
considered and how bad were they)?
> 1. Initial arguments don't work, that's what I expected anyway and
> I can work around that.
Could you clarify what you mean by "initial arguments don't work"?
Can you add a method to `initialize-instance` or something like 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?
IIRC you might be able to get what you want by adding a method to
`slot-missing`. This will not impact the normal performance of slot-value.
Stefan
prev parent reply other threads:[~2018-11-21 14:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 5:33 Support virtual slots in EIEIO Yuan Fu
2018-11-21 14:50 ` Stefan Monnier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv36rumr1d.fsf-monnier+gmane.emacs.devel@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).