Kenny Tilton writes:
Thomas F. Burdick wrote:
(defclass foo () ((a :accessor foo-a :type fixnum)))
and if you try to set an A slot to something other than a fixnum, you'll get a runtime error.
Okay, I need to lay of the crack a little. PCL is not so well integrated into SBCL as all this. What I said applies to instances of structure-class, when defined with defstruct, but not any kind of anything you can define with defclass. Oops. It's still something that should happen when PCL is better integrated, though.
Me again:
-- or, have Cells propagate the type declaration to its new method definitions.
I would still like to see this, though. Hell, maybe cells:defmodel will behave more in line with declarations=assertions than cl:defclass
If DEFMODEL stuffs type info by slot and class into some global hash or property list, at make-instance time we can pull the type info into a dedicated slot in the cell structure. would that help in anyway? Looks like THE cannot use a dynamic type.
Lemme think about this. I bet we could have DEFMODEL construct stash a reader/setter pair away somewhere and use them instead of SLOT-VALUE. There's gotta be some inoffensive way to leverage the host CL's type system's abilities.