I have two packages with a class defined in each. The second class inherits from the first but has a slot of the same name. The intention is indeed to override the slot.
(defpackage :foo
(:use :cl)
(:export foo))
(in-package :foo)
(defclass foo () ((s)))
(defpackage :bar
(:use :cl :foo)
(:export bar))
(in-package :bar)
(defclass bar (foo) ((s)))
sbcl gives a helpful warning when I make an instance of bar
(make-instance 'bar)
STYLE-WARNING:
slot names with the same SYMBOL-NAME but different SYMBOL-PACKAGE (possible
package problem) for class #<STANDARD-CLASS BAR:BAR>:
(FOO::S BAR::S)
Since it is the intended behaviour, I can suppress that warning like this:
(handler-bind (#+SBCL (style-warning #'muffle-warning))
(make-instance 'bar))
However I would like users of the bar
class to be able to make instances without getting the warning.
I could write a wrapper function containing the code in the previous code block but is it possible to suppress the warning in advance of calls to (make-instance 'bar)
without muffling all style warnings?