Jason K. MacDuffie 8f70a5c9ba Kind of goofy, but define-generic makes sense | 8 年 前 | |
---|---|---|
doc | 12 年 前 | |
examples | 12 年 前 | |
scheme | 8 年 前 | |
AUTHORS | 12 年 前 | |
BLURB | 12 年 前 | |
COPYING | 12 年 前 | |
Makefile | 12 年 前 | |
NEWS | 12 年 前 | |
README.md | 8 年 前 | |
pkg-def.scm | 12 年 前 |
This is prometheus ported to an R7RS library.
Prometheus is a prototype-based message-passing object system. This means that there are no classes, but instead, objects are created and modified on the fly until they match the specified behavior. Then, these objects can be "cloned" into a new object which inherits the whole behavior of the parent objects. An object in this world is just a set of named slots which can be accessed or run by sending a message to the object.
In Prometheus, objects are closures that receive as the first argument a message selector, and arguments to the message as remaining arguments. See the Prometheus manual for further information.
The canonical URL for Prometheus is http://www.forcix.cx/software/prometheus.html
In any R7RS repl, do:
> (import (prometheus user))
> (define my-object (*the-root-object* 'clone))
> (my-object 'add-value-slot! 'fnord 'set-fnord! 23)
> (my-object 'fnord)
23
> (object? my-object)
#t
No bugs known to me, but look at the Pitfalls section in the Prometheus manual.
This object system does not intend to integrate with the rest of Scheme. It's only a tool to describe a problem domain.
This project abuses too many names from Greek mythology. The author apologizes profusely for this.
NOTE: With the addition of the object? predicate, there is a behavior that may be considered a bug. The predicate will execute the input procedure, which may be unexpected and lead to changes in state or take an unexpectedly long time. For example, (object? display) will display something. I don't see a way around this unfortunately, given the way Prometheus works.