Enforcing required slot values
I was reading a blog post by Robert Smith on ideas for future directions for Lisp type systems, where Robert mentioned the following trick to enforce provision of required slot values for structures and classes:
(defstruct foo
(slot1 (error "Must provide value for slot1")))
That's something I haven't thought of doing before, I hope you find it useful as well. The rest of Robert's article is well worth a read.
No comments:
Post a Comment