From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: 28489@debbugs.gnu.org
Subject: bug#28489: 27.0.50; eieio-persistent slot type validation should be a bit smarter
Date: Sun, 17 Sep 2017 17:43:58 -0700 [thread overview]
Message-ID: <87lglcn8dt.fsf@ericabrahamsen.net> (raw)
EIEIO object slots can have a :type that looks like "(or thing1 thing2
...)", meaning, obviously, that the value of the slot is legal if it is
of any of those types.
`eieio-persistent-validate/fix-slot-value' makes a first pass over the
slot type specification, to see if any of the "things" are class
symbols. The checking is done by
`eieio-persistent-slot-type-is-class-p', which is able to handle an `or'
statement. The bug comes with:
((eq (car-safe type) 'or)
;; If type is a list, and is an or, it is possibly something
;; like (or null myclass), so check for that.
(let ((ans nil))
(dolist (subtype (cdr type))
(setq ans (eieio-persistent-slot-type-is-class-p
subtype)))
ans))
In effect, only the last element of the `or' statement is checked, which
is obviously a bug. The Right Thing would probably be to return all the
valid class types in the list (with `seq-filter' or its equivalent), and
then change the rest of the code to accept that list.
Otherwise, the spec and value get passed to `cl-typep' directly, which
would successfully validate, except that "value" is still an object
construction form, not a constructed object.
It just seems like there's a lot of overlap between this and `cl-typep'.
And, coincidentally, I'm getting bug reports about the very slow
performance of `eieio-persistent-read'! I wonder if `cl-typep' could be
taught to handle some more of these cases.
The minimum fix seems to be to have
`eieio-persistent-slot-type-is-class-p' return a list of classes when
necessary. I can take a whack at a patch for that, if acceptable.
In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
of 2017-09-17 built on clem
next reply other threads:[~2017-09-18 0:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 0:43 Eric Abrahamsen [this message]
[not found] ` <handler.28489.B.150569546424990.ack@debbugs.gnu.org>
2017-09-26 20:22 ` bug#28489: Acknowledgement (27.0.50; eieio-persistent slot type validation should be a bit smarter) Eric Abrahamsen
2017-09-27 0:05 ` Noam Postavsky
2017-09-27 16:39 ` Eric Abrahamsen
2017-09-28 2:23 ` Noam Postavsky
2017-09-28 5:02 ` Eric Abrahamsen
2017-09-29 0:35 ` Noam Postavsky
2017-09-29 20:31 ` Eric Abrahamsen
2017-09-30 0:57 ` Noam Postavsky
2017-09-30 18:05 ` Eric Abrahamsen
2017-09-30 21:58 ` Noam Postavsky
2017-09-30 23:30 ` Eric Abrahamsen
2017-10-14 12:13 ` Eric Abrahamsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lglcn8dt.fsf@ericabrahamsen.net \
--to=eric@ericabrahamsen.net \
--cc=28489@debbugs.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.