emacs-devel
[Top][All Lists]
Advanced

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

Re: esup byte compile warnings


From: Serghei Iakovlev
Subject: Re: esup byte compile warnings
Date: Wed, 29 Jan 2020 12:56:40 +0000

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 <address@hidden> 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 via email to

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