lisp-binary icon indicating copy to clipboard operation
lisp-binary copied to clipboard

Add subtyping support for `defbinary`

Open bohonghuang opened this issue 6 months ago • 0 comments

Before this PR, the struct types declared through defbinary did not have a subtype relationship with the types they :include, potentially losing some code reuse capability. This PR makes the following possible:

(defbinary a ()
  (header 0 :type (unsigned-byte 32)))

(defbinary b (:include a)
  (body 0 :type (unsigned-byte 32)))

(subtypep 'b 'a) ; => T, T

bohonghuang avatar Aug 05 '24 23:08 bohonghuang