source: project/release/4/prometheus/prometheus-2/examples/create-on-use.scm @ 14451

Last change on this file since 14451 was 14451, checked in by sjamaan, 11 years ago

Port Prometheus-2 to Chicken, using the clean, unmodified code from the release

File size: 612 bytes
1;;; A simple object which creates slots as they are used. This
2;;; demonstrates the use of the MESSAGE-NOT-UNDERSTOOD error message.
4;;; Slots behave like value slots, and the accessors use a second
5;;; argument as the "default value". If that is not given, (if #f #f)
6;;; is used, which is usually not what is intended.
7(define-object create-on-use-object (*the-root-object*)
8  ((message-not-understood self resend slot args)
9   (self 'add-method-slot! slot (lambda (self resend . default)
10                                  (if (pair? args)
11                                      (car args))))
12   (self slot)))
Note: See TracBrowser for help on using the repository browser.