Access Driven Programming--Daemons

Access based programming is a paradigm where certain actions are performed, or some constraints are checked, when "access operations" are invoked. Access operations for updates (i.e. assert, retract) can be redefined in an object by redefining these operations and delegating the same operation to super. Notice that without a delegation mechanism this would not be possible, since the Self would have changed. So assume that we want to print on the screen "p is augmented" whenever the fact p(X) is asserted in an object foo, we just redefine assert/1:

     foo :: {
             super(object) &
     
             dynamic p/1 &
     
             p(0) &
             p(1) &
     
             assert(p(X)) :- !,   /* assert/1 is redefined for p(X) */
                     super <: assert(p(X)),
                     :display('p is augmented'), :ttynl &
             assert(M) :-         /* delegating assert(_) messages */
                     super <: assert(M) &
             :
             }.