X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=rules.lisp;h=d2149f4b5af600f7c74260428e48afbcea6f66e4;hb=a4c5cb60bc8a39d7907e0c380db2d3d29f1df3af;hp=16be30dcf3de80676d9d989ab0bf48902296636f;hpb=44f2af4c46a82e11b035c30b81dd73c378535453;p=hyperobject.git diff --git a/rules.lisp b/rules.lisp index 16be30d..d2149f4 100644 --- a/rules.lisp +++ b/rules.lisp @@ -7,10 +7,9 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: rules.lisp,v 1.20 2003/04/22 15:53:25 kevin Exp $ -;;;; -;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg +;;;; $Id: rules.lisp,v 1.40 2003/05/15 06:18:02 kevin Exp $ ;;;; +;;;; This file is Copyright (c) 2000-2003 by Kevin M. Rosenberg ;;;; ************************************************************************* (in-package :hyperobject) @@ -65,34 +64,22 @@ (funcall (func rule) obj))))) -(defmethod (setf slot-value-using-class) - :around (new-value (cl hyperobject-class) obj - (slot standard-effective-slot-definition)) - (call-next-method)) - -(defmethod (setf slot-value-using-class) - :around (new-value (cl hyperobject-class) obj - (slot standard-effective-slot-definition)) - #+ignore - (cmsg-c :verbose "Setf slot value: class: ~s, obj: ~s, slot: ~s, value: ~s" cl (class-of obj) slot new-value) - - (let ((func (slot-value slot 'value-constraint))) - (cond - #+ignore - ((and func (not (funcall func new-value))) - (warn "Rejected change to value of slot ~a of object ~a" - (slot-definition-name slot) obj) - (slot-value obj (slot-definition-name slot))) - (t - (prog1 - (call-next-method) - (when (direct-rules cl) - (fire-class-rules cl obj slot)))))) - ) - #+ignore -(defmethod slot-value-using-class :around ((cl hyperobject-class) obj - (slot standard-effective-slot-definition)) - (let ((value (call-next-method))) - (cmsg-c :verbose "slot value: class: ~s, obj: ~s, slot: ~s" cl (class-of obj) slot) - value)) +(defmethod (setf slot-value-using-class) :around + (new-value (cl hyperobject-class) obj (slot hyperobject-esd)) + + #+ignore + (cmsg-c :verbose "Setf slot value: class: ~s, obj: ~s, slot: ~s, value: ~s" cl (class-of obj) slot new-value) + + (let ((func (when (slot-boundp slot 'value-constraint) + (esd-value-constraint slot)))) + (cond + ((and func (not (funcall func new-value))) + (warn "Rejected change to value of slot ~a of object ~a" + (slot-definition-name slot) obj) + (slot-value obj (slot-definition-name slot))) + (t + (prog1 + (call-next-method) + (when (direct-rules cl) + (fire-class-rules cl obj slot)))))))