README.md 1.7 KB

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.