From: Mark Wooding Date: Sun, 30 Aug 2015 09:57:57 +0000 (+0100) Subject: src/classes.lisp: Add comment explaining why psets aren't captured. X-Git-Tag: 0.2.0~49 X-Git-Url: https://git.distorted.org.uk/~mdw/sod/commitdiff_plain/59146e6e6846ce273a66f990c414e3f1a9c42da5 src/classes.lisp: Add comment explaining why psets aren't captured. This one had me wondering for a while, but it turns out there's a good reason. --- diff --git a/src/classes.lisp b/src/classes.lisp index c81c41e..603ea98 100644 --- a/src/classes.lisp +++ b/src/classes.lisp @@ -25,6 +25,21 @@ (cl:in-package #:sod) +;;; Note! You'll notice that none of the classes defined here store property +;;; sets persistently, even though there's a `:pset' keyword argument +;;; accepted by many of the classes' initialization methods. That's because +;;; part of the pset protocol involves checking that there are no unused +;;; properties, and this typically happens shortly after the appropriate +;;; objects are constructed. It would be tempting to stash the pset at +;;; initialization time, and then pick some property from it out later -- but +;;; that won't work in general because an error might have been signalled +;;; about that property. It wouldn't surprise me greatly to discover that +;;; `most' code paths resulted in the property being looked up in time to +;;; avoid the unused-property error, but a subtle change in circumstances +;;; then causes a thing done on demand to be done later, leading to +;;; irritating and misleading errors being reported to the user. So please +;;; don't do that. + ;;;-------------------------------------------------------------------------- ;;; Classes.