* How to silence "Unknown slot" compiler warnings?
@ 2016-02-15 20:15 Vitalie Spinu
2016-02-15 21:13 ` Stephen Leake
0 siblings, 1 reply; 8+ messages in thread
From: Vitalie Spinu @ 2016-02-15 20:15 UTC (permalink / raw)
To: emacs-devel
Hi,
I am getting loads of "Unknown slot" messages during compilation of my
package. Why are they happening and how can I silence them?
My use case is simple, define a class, create an object of that class and store
it in buffer local variable. Now, all instances of oref, oset and macros that
operate on those objects generate this warning.
Thanks,
Vitalie
GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.7) of 2016-01-21
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to silence "Unknown slot" compiler warnings?
2016-02-15 20:15 How to silence "Unknown slot" compiler warnings? Vitalie Spinu
@ 2016-02-15 21:13 ` Stephen Leake
2016-02-16 0:22 ` Vitalie Spinu
0 siblings, 1 reply; 8+ messages in thread
From: Stephen Leake @ 2016-02-15 21:13 UTC (permalink / raw)
To: Vitalie Spinu; +Cc: emacs-devel
Vitalie Spinu <spinuvit@gmail.com> writes:
> I am getting loads of "Unknown slot" messages during compilation of my
> package. Why are they happening and how can I silence them?
They happen because the byte compiler is pickier than you are about how
to spell the names of the slots.
> My use case is simple, define a class, create an object of that class and store
> it in buffer local variable. Now, all instances of oref, oset and macros that
> operate on those objects generate this warning.
Please post the code (or at least some of it), and the warnings.
--
-- Stephe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to silence "Unknown slot" compiler warnings?
2016-02-15 21:13 ` Stephen Leake
@ 2016-02-16 0:22 ` Vitalie Spinu
2016-02-16 5:38 ` Eric Abrahamsen
2016-02-21 2:05 ` Stefan Monnier
0 siblings, 2 replies; 8+ messages in thread
From: Vitalie Spinu @ 2016-02-16 0:22 UTC (permalink / raw)
To: Stephen Leake; +Cc: emacs-devel
>> On Mon, Feb 15 2016 15:13, Stephen Leake wrote:
> Please post the code (or at least some of it), and the warnings.
It's here:
https://github.com/vspinu/polymode/blob/master/polymode-classes.el
I am always using :initarg with keywords because I want to emphasise slot names
in main code:
(defclass pm-polymode (pm-root)
((hostmode
:initarg :hostmode
Vitalie
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to silence "Unknown slot" compiler warnings?
2016-02-16 0:22 ` Vitalie Spinu
@ 2016-02-16 5:38 ` Eric Abrahamsen
[not found] ` <871t8dase0.fsf@gmail.com>
2016-02-21 2:05 ` Stefan Monnier
1 sibling, 1 reply; 8+ messages in thread
From: Eric Abrahamsen @ 2016-02-16 5:38 UTC (permalink / raw)
To: emacs-devel
Vitalie Spinu <spinuvit@gmail.com> writes:
>>> On Mon, Feb 15 2016 15:13, Stephen Leake wrote:
>
>> Please post the code (or at least some of it), and the warnings.
>
> It's here:
>
> https://github.com/vspinu/polymode/blob/master/polymode-classes.el
>
> I am always using :initarg with keywords because I want to emphasise slot names
> in main code:
>
> (defclass pm-polymode (pm-root)
> ((hostmode
> :initarg :hostmode
>
>
> Vitalie
You're using oref/oset with arguments as :tags, but the slot name should
just be a non-quoted, non-tag macro argument.
E
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to silence "Unknown slot" compiler warnings?
2016-02-16 0:22 ` Vitalie Spinu
2016-02-16 5:38 ` Eric Abrahamsen
@ 2016-02-21 2:05 ` Stefan Monnier
2016-02-21 4:13 ` Eric Abrahamsen
1 sibling, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2016-02-21 2:05 UTC (permalink / raw)
To: emacs-devel
> I am always using :initarg with keywords because I want to emphasise
> slot names in main code:
> (defclass pm-polymode (pm-root)
> ((hostmode
> :initarg :hostmode
:hostmode is not a slot name, it's an initarg name. EIEIO is mostly an
implementation of CLOS, but for some reason it decided to allow you to
say (slot-value x :hostmode) instead of (slot-value x 'hostmode).
The two are equivalent, except that:
- (slot-value x :hostmode) is not accepted by CLOS.
- (slot-value x :hostmode) is slower.
> I can't say why! I'm also a little uncomfortable about the "naked"
> versions, and for the same reason -- my brain keeps seeing them as
> variables.
The "naked" version only shows up with (oref x hostmode) which is an
EIEIO-only macro which is equivalent to (slot-value x 'hostmode).
As you can see, the (slot-value x 'hostmode) version doesn't suffer from
this problem (and additionally it's part of CLOS), so I encourage you to
use that instead.
EIEIO can't take advantage of the compile-time-knowledge of `hostmode'
to speed up the slot access anyway, so you might as well use `slot-value'.
Both `oref' and `slot-value' are "namespace unclean" (they don't have
any kind of "package prefix"), but `oref' is a much more likely
candidate to obsolescence because `slot-value' at least has the argument
that it's a standard CLOS name.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to silence "Unknown slot" compiler warnings?
2016-02-21 2:05 ` Stefan Monnier
@ 2016-02-21 4:13 ` Eric Abrahamsen
0 siblings, 0 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2016-02-21 4:13 UTC (permalink / raw)
To: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
[...]
>> I can't say why! I'm also a little uncomfortable about the "naked"
>> versions, and for the same reason -- my brain keeps seeing them as
>> variables.
>
> The "naked" version only shows up with (oref x hostmode) which is an
> EIEIO-only macro which is equivalent to (slot-value x 'hostmode).
> As you can see, the (slot-value x 'hostmode) version doesn't suffer from
> this problem (and additionally it's part of CLOS), so I encourage you to
> use that instead.
> EIEIO can't take advantage of the compile-time-knowledge of `hostmode'
> to speed up the slot access anyway, so you might as well use `slot-value'.
Thanks! It's good to have a clear answer to that.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-02-21 4:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-15 20:15 How to silence "Unknown slot" compiler warnings? Vitalie Spinu
2016-02-15 21:13 ` Stephen Leake
2016-02-16 0:22 ` Vitalie Spinu
2016-02-16 5:38 ` Eric Abrahamsen
[not found] ` <871t8dase0.fsf@gmail.com>
2016-02-16 14:15 ` Eric Abrahamsen
2016-02-16 14:51 ` Stephen Leake
2016-02-21 2:05 ` Stefan Monnier
2016-02-21 4:13 ` Eric Abrahamsen
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.