unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* compiler warnings for "unused" method specializers
@ 2016-10-13 23:38 Eric Abrahamsen
  2016-10-13 23:39 ` Lars Ingebrigtsen
  2016-10-14  0:43 ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2016-10-13 23:38 UTC (permalink / raw)
  To: emacs-devel

I'm having to go through a whole bunch of code and add leading
underscores to method parameters used as specializers, to quiet the
compiler. I guess this makes sense, in a way -- the parameters aren't
actually used in the function body -- but doesn't make sense in another
way: the parameters are essential to determining how and when this
method is run. So I need to do:

(cl-defmethod foo ((thing my-object) (_style (eql disco)))
  (message "%s points at the ceiling" thing))

There might be better solutions for this stupid example, but I have many
cases where it's pretty much necessary to specialize on a parameter that
isn't actually used.

My other instinct was to just put "_" for all unused parameters, but if
there's more than one of those, the compiler complains about repeated
variables.

Could the compiler special-case this situation somehow (either not
complaining about unused variables, or not complaining about repeated
variables)? Or am I just being overly persnickety about this?

Eric




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-10-14 19:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-13 23:38 compiler warnings for "unused" method specializers Eric Abrahamsen
2016-10-13 23:39 ` Lars Ingebrigtsen
2016-10-14  0:43 ` Stefan Monnier
2016-10-14  6:23   ` Eric Abrahamsen
2016-10-14 12:59     ` Stefan Monnier
2016-10-14 13:01     ` Elias Mårtenson
2016-10-14 13:07       ` Stefan Monnier
2016-10-14 19:08         ` Eric Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).