From: Eric Ludlam <ericludlam@gmail.com>
To: David Engster <deng@randomsample.de>
Cc: 18494@debbugs.gnu.org, Tom Tromey <tom@tromey.com>,
Eric Ludlam <eric@siege-engine.com>
Subject: bug#18494: 24.4.50; defclass creates undocumented *-list-p function
Date: Sat, 20 Sep 2014 15:53:58 -0400 [thread overview]
Message-ID: <541DDB56.1020000@gmail.com> (raw)
In-Reply-To: <87bnqavaju.fsf@engster.org>
On 09/20/2014 06:41 AM, David Engster wrote:
> [add CC Eric]
>
> Tom Tromey writes:
>> Try:
>>
>> (defclass zzz-whatever () ((hi)))
>>
>> Now notice there is a new function:
>>
>> (symbol-function 'zzz-whatever-list-p)
>> (lambda (obj) "Test OBJ to see if it a list of objects which are a child of type zzz-whatever" (when (listp obj) (let ((ans t)) (while (and obj ans) (setq ans (and (eieio-object-p (car obj)) (object-of-class-p (car obj) zzz-whatever))) (setq obj (cdr obj))) ans)))
>>
>>
>> This new -list-p function is not documented in the EIEIO manual.
>>
>> It seems to me that it would be a bit better not to define it.
>> It doesn't seem generally useful enough, to me.
> I agree it's not generally useful. It was added as a helper function to
> validate a slot which should hold a list of objects (as part of the
> EIEIO/EDE security fix for Emacs 23.4).
>
> At least that's what I remember. I was under the impression that
> eieio-persistent-validate/fix-slot-value would use this, but I cannot
> see it; maybe it's just hidden very well. If it is not used, I'd agree
> that it should better be removed or at least renamed to X--list-p.
Hi,
I found that many of my programs that use EIEIO have slots that are of
:type that is an object of some class, which is why there are base
predicates. Thus, if I have some object class foo, I can set to the
:type of some other class to foo, instead of some other more complex
type. Having another predicate that also handles the list of objects
that include subclasses is just handy.
David is right about the time when it was introduced, where only slots
with a constrained :type for an object were allowed to be loaded in,
allowing the loader to never 'eval anything, only read.
Technically, I could hand write a few of those predicates for the EDE
loader, but I thought it would be generally useful, especially if other
folk want to save their objects. I'm not sure how widely used it is
outside of EDE, semanticdb, and cogre which all have save files. I
certainly think it should be documented if consensus is that it stays.
Perhaps an extra option for the defclass to add extra predicates along
with :method-invocation-order.
Eric
next prev parent reply other threads:[~2014-09-20 19:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 2:09 bug#18494: 24.4.50; defclass creates undocumented *-list-p function Tom Tromey
2014-09-20 10:41 ` David Engster
2014-09-20 19:53 ` Eric Ludlam [this message]
2014-09-20 23:08 ` Stefan Monnier
2014-09-20 23:34 ` Eric Ludlam
2014-09-21 16:20 ` Stefan Monnier
2014-09-21 16:37 ` Eric Ludlam
2014-10-17 5:11 ` Stefan Monnier
2022-01-30 21:21 ` Lars Ingebrigtsen
2022-01-31 2:34 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-31 15:33 ` Lars Ingebrigtsen
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=541DDB56.1020000@gmail.com \
--to=ericludlam@gmail.com \
--cc=18494@debbugs.gnu.org \
--cc=deng@randomsample.de \
--cc=eric@siege-engine.com \
--cc=tom@tromey.com \
/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).