Plaster

common-lisp
#| Using the Meta-Object Protocol, I wrote a simple implementation of the "Worlds" concept for controlling side effects. We previously defined the class FOO as (defclass f () ((bar :initarg :bar) (baz :initarg :baz)) (:metaclass worlds:world-class)) We only need the MOP and trivial-garbage portability libraries to make this trick work in Common Lisp. |# CL-USER> (let ((world (worlds:sprout)) (g (make-instance 'foo :bar "BAR"))) (worlds:with-world (world) (setf (slot-value g 'bar) "QUUX") (print (slot-value g 'bar))) (print (slot-value g 'bar)) (worlds:commit world) (print (slot-value g 'bar))) "QUUX" "BAR" "QUUX"