(require (file "../prometheus.ss"))
(define account (*the-root-object* 'clone))
(account 'add-value-slot! 'balance 'set-balance! 0)
(account 'add-method-slot! 'payment!
(lambda (self resend amount)
(self 'set-balance!
(+ (self 'balance)
amount))))
(define a1 (account 'clone))
(define a2 (account 'clone))
(a1 'payment! 100)
(a2 'payment! 200)
(a1 'balance)
(a2 'balance)
(a1 'payment! -20)
(a1 'balance)
(define-method (account 'payment! self resend amount)
(self 'set-balance!
(+ (self 'balance)
amount)))
(define-object account (*the-root-object*)
(balance set-balance! 0)
((payment! self resend amount)
(self 'set-balance!
(+ (self 'balance)
amount))))