[Top][All Lists]

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

compiler warnings for "unused" method specializers

From: Eric Abrahamsen
Subject: compiler warnings for "unused" method specializers
Date: Thu, 13 Oct 2016 16:38:16 -0700
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/26.0.50 (gnu/linux)

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

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?


reply via email to

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