all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Serghei Iakovlev <egrep@protonmail.ch>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: GNU Emacs Developers <emacs-devel@gnu.org>
Subject: Re: esup byte compile warnings
Date: Wed, 29 Jan 2020 12:56:40 +0000	[thread overview]
Message-ID: <104542A5-436D-44DB-AEE2-9DB5D64FAC01@protonmail.ch> (raw)
In-Reply-To: <jwviml0o73k.fsf-monnier+emacs@gnu.org>

I've replaced all the ‘oref’ with ‘slot-value’ and properly used
quotes for the slot names.  Thus, I've replaced

 (oref x :y)

by

 (slot-value x 'y)

This seems is works, but still there are some warnings remaining.
For example:

 In esup-total-exec-time:
 esup.el:166:52: Warning: Unknown slot ‘exec-time’

 In esup-total-gc-number:
 esup.el:172:52: Warning: Unknown slot ‘gc-number’

 In esup-total-gc-time:
 esup.el:178:50: Warning: Unknown slot ‘gc-time’

 In esup-drop-insignificant-times:
 esup.el:186:39: Warning: Unknown slot ‘exec-time’
 esup.el:530:25: Warning: Unknown slot ‘file’
 esup.el:538:9: Warning: Unknown slot ‘start-point’
 esup.el:545:30: Warning: Unknown slot ‘line-number’
 esup.el:548:30: Warning: Unknown slot ‘exec-time’
 esup.el:546:30: Warning: Unknown slot ‘percentage’
 esup.el:549:30: Warning: Unknown slot ‘expression-string’

 In esup-fontify-results:
 esup.el:560:15: Warning: Unknown slot ‘expression-string’

Consider the following defun:

 (defun esup-total-exec-time (results)
   "Calculate the total execution time of RESULTS."
   (cl-loop for result in results
            sum (slot-value result 'exec-time) into total-exec-time
            finally return total-exec-time))

This produces a waring:

 In esup-total-exec-time:
 esup.el:166:52: Warning: Unknown slot ‘exec-time’

Looks like the reason is that the byte-compiler unable to match
‘result’ with the class declaration.

I found similar [1] issues [2], but I'm still not pretty sure the
proper way to fix these warnings.

[1]: https://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00678.html
[2]: https://lists.gnu.org/archive/html/emacs-devel/2016-02/msg00880.html

> On 24 Jan 2020, at 23:55, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 
> 
>> There are `esup' [1] byte compile warnings I would like avoid to.
>> Some of them seems trivial to me.  However, I don't quite understand
>> slots related warnings.
> 
> The the slots, usually it's just that code that uses EIEIO seems to
> misuse a weird feature of EIEIO, so they use the initval keyword instead
> of the slot name when accessing the slot.  For example, often code will
> do
> 
>    (slot-value x :file)
> 
> where the slot's name is not `:file` but `file`, so the correct usage is
> 
>    (slot-value x 'file)
> 
> This odd usage does work for historical reasons but is deprecated, hence
> the warning.
> 
> 
>        Stefan
> 
> 





  reply	other threads:[~2020-01-29 12:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 20:48 esup byte compile warnings Serghei Iakovlev
2020-01-24 21:55 ` Stefan Monnier
2020-01-29 12:56   ` Serghei Iakovlev [this message]
2020-01-29 14:32     ` Stefan Monnier
2020-01-29 14:42       ` Serghei Iakovlev

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=104542A5-436D-44DB-AEE2-9DB5D64FAC01@protonmail.ch \
    --to=egrep@protonmail.ch \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.