R7RS port of Prometheus

Jason K. MacDuffie 8f70a5c9ba Kind of goofy, but define-generic makes sense 7 years ago
doc d5e40cd240 Transfer from darcs to hg 12 years ago
examples d5e40cd240 Transfer from darcs to hg 12 years ago
scheme 8f70a5c9ba Kind of goofy, but define-generic makes sense 7 years ago
AUTHORS d5e40cd240 Transfer from darcs to hg 12 years ago
BLURB d5e40cd240 Transfer from darcs to hg 12 years ago
COPYING d5e40cd240 Transfer from darcs to hg 12 years ago
Makefile d5e40cd240 Transfer from darcs to hg 12 years ago
NEWS d5e40cd240 Transfer from darcs to hg 12 years ago
README.md 723f2f3d05 Add a caveat for object? 7 years ago
pkg-def.scm d5e40cd240 Transfer from darcs to hg 12 years ago

README.md

Prometheus R7RS

This is prometheus ported to an R7RS library.

Overview

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

Quickstart

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

Bugs and limitations

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.