Jason K. MacDuffie d9d8bab124 do not use format | 8 years ago | |
---|---|---|
.gitignore | 8 years ago | |
LICENSE | 8 years ago | |
Makefile | 8 years ago | |
README.md | 8 years ago | |
yasos.scrbl | 8 years ago | |
yasos.sld | 8 years ago |
NOTES: An object system for Scheme based on the paper by Norman Adams and Jonathan Rees: "Object Oriented Programming in Scheme", Proceedings of the 1988 ACM Conference on LISP and Functional Programming, July 1988 [ACM #552880].
(define-operation (opname self arg ...) default-body)
(define-predicate opname)
(object ((name self arg ...) body) ... )
(object-with-ancestors ( (ancestor1 init1) ...) operation ...)
;; in an operation {a.k.a. send-to-super}
(operate-as component operation self arg ...)
> (import (yasos))
> (define-predicate instance?)
> (define-operation (instance-dispatcher obj)
0)
> (define (make-instance dispatcher)
(object
((instance? self) #t)
((instance-dispatcher self) dispatcher)))
> (define x (make-instance 100))
> (instance? x)
#t
> (instance-dispatcher x)
100
> (instance? "Not an instance")
#f
> (instance-dispatcher "Not an instance")
0
Original program by Kenneth Dickey. Improvements made by Juergen Lorenz. Ported to R7RS by Jason K. MacDuffie.
LICENSE: MIT (Expat) license. See LICENSE for details.