Skip to content

Need to bind *handle-warn-on-redefinition* on LispWorks #5

Description

@Yehouda

(with-packages-unlocked (cl)

Loading this file in LispWorks gives this error:

Defining function (SETF STREAM-ELEMENT-TYPE) visible from package COMMON-LISP { handle-warn-on-redefinition is :ERROR }

I fixed this in our copy (from quicklisp) by wrapping the with-packages-unlocked with:

(let (#+lispworks (lw:*handle-warn-on-redefinition* :quiet))
(with-packages-unlocked (cl)
  (defmethod (setf stream-element-type) (new-val (stream bitio-stream))
    (with-accessors ((byte-size bitio::default-bits-per-byte)) stream
      (assert (eq 'unsigned-byte (car new-val)))
      (setf byte-size (second new-val))))))

BTW: The fact that this and the with-packages-unlocked is needed tells you you are probably doing something wrong. In this case, it is wrong because you are defining (setf stream-element-type), even though the generic function is not applicable to stream instances in general. It should be (setf bitio-stream-element-type). Even better, since it only sets the "byte-size", it would be better to have an accessor bitio-stream-byte-size that returns it and can be used in setf.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions