Juho Snellman <jsnell@...> writes:
> Some of the more annoying SBCL style-warnings are signaled at load
> time (function/defmethod redefinition, defmethod without defgeneric,
> etc) rather than at compile-time, and thus can't be controlled with
> MUFFLE-CONDITIONS declarations.
> While the normal solution would be to wrap a suitable handler for
> style-warnings around the load, I don't really like that solution.
> The code can actually be loaded in several different ways, for example
> through ASDF, using Slime C-c C-c or C-c C-k, using LOAD manually, or
> evaluating the defun/defmethod on the REPL. It's not really feasible
> to bind a handler around all of these.
That is arguably true, yes.
> So I'd like to make load-time warnings also mufflable with the same
> mechanism as compile-time ones, using the condition-handlers that have
> been globally proclaimed at the time the warning is signalled. This
> would only apply to certain conditions that SBCL itself signals during
> load-time, any conditions from user code would be handled as
> currently. (A rough patch attached).
> Does this seem reasonable?
I'm not sure. At this point you should bear in mind, much as WHN will
attest as to my first reply to him after he granted me CVS write
access: I have had entirely too much to drink this evening, along with
too much to eat, and so you should take this response with as much
salt as I have ingested this evening.
I think that there are two different kinds of style warning that your
patch is addressing: there are the style warnings that really would be
proper style warnings except that SBCL is too stupid to signal them
only in the right circumstance: the redefinition of a function is the
prime example, for there the style-warning should only be signalled if
the redefinition is from a logically different piece of code. This
also applies to the redefining ~S in DEFGENERIC/DEFMETHOD cases.
Then there are the cases when the style warning is unconditionally a
style warning, but the user might legitimately not care about the
entire class of such style warnings: DEFMETHOD without DEFGENERIC and
the like. In this case it would I think be reasonable to handle it
according to a mechanism similar to your patch, but I'm less convinced
of the need: usually the style warning happens only once, rather than
several times through the course of redefinition; given that, it seems
reasonable for the "system" loader to take responsibility for the
muffling for the dynamic contour of the first-time loading, with an
asdf :around method or equivalent: all that is needed for this case to
be dealt with is an exported condition type that users can handle
> +(defmacro with-null-lexenv-condition-handlers (&body body)
Prefer with-null-lexenv-condition-handlers ((&key) &body body) for
If you reply to this, I'll try to be more coherent when I'm sobrierer.