emacs-devel
[Top][All Lists]
Advanced

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

Re: Towards a cleaner build: cedet


From: Stefan Monnier
Subject: Re: Towards a cleaner build: cedet
Date: Thu, 13 Jun 2019 12:35:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> cedet/ede/config.el:388:5:Warning: Unknown slot `:c-preprocessor-table'
[...]
> Oh!  Those are without colons?  Is that the entire issue here, that the
> check is strict about colons/not colons and the rest of cedet doesn't
> care?

Here's the story:
- in CLOS, you can access slots with `slot-value` where you specify the
  slot-name (typically a non-keyword symbol).
- in CLOS, `defclass` can specify for each slot an "initializer"
  keyword, which is the keyword to pass to `make-instance` to provide an
  initial value for that slot.
  Typically, this initializer keyword is the slot name with a leading ":".
- when Eric wrote EIEIO, he made his version of `slot-value` accept
  the use of the initializer keyword as an alias for the slot-name.
  [ In theory, this indirection gives you a bit of extra flexibility
    since a given initializer keyword can be mapped to different
    slot-names in different classes, but I've never seen any code take
    advantage of that nor can I easily imagine a use-case where this
    would come in handy.  ]
- in CEDET a lot of the code uses the initializer keyword rather than
  the slot-name for some reason (I assume Eric started it and the rest
  followed).  AFAICT most people don't really understand the difference
  between initializer keyword and slot-name in EIEIO for that reason.
- Using the initializer keyword rather than the slot name is actually
  marginally slower.

I'd like to deprecate this "feature" of EIEIO which just makes things
(marginally) slower and makes EIEIO unnecessarily different from CLOS.

So the warning only checks if the slot-name provided to `slot-value` is
known, and doesn't try to accommodate initializer keywords since I think
that should be deprecated.

So for 99% of those warnings, the fix is to remove the leading `:` (or
to replace it with a quote, depending on whether it's passed to
a function like `slot-value` or to a macro like `oref`).


        Stefan




reply via email to

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