How Gerbil Poo’s Objection Orientation System works

We have 2 concepts:

  1. Prototype

  2. Instance

Prototypes

Partial, incremental specification of computations.

They can be compose into more complete specifications. This is done via inheritance.

Instance

Suppose you have a suitable specification. You can extract the according computation, and compute the result (the instance).

This process is known as instantiation. It can be done using a fixed-point operator (fix).

An instance is a set of slots, each binding a name to a value.

In other languages this is known as object keys and values, fields and attributes, methods.

{ x: 1
, y: 2
}

Prototype

A Prototype is an incremental description of how each slot of an instance can be computed from other slots of the instance or inherited from super-prototypes.

Object

Pure functional setting => all instances of a prototype are equal.

We can cache the prototype, carrying with every instance the prototype from which it was generated.

You can use this to:

  • Build new prototypes (and discard instance info)

  • Shallowly copy object’s instance / use and export its computation results.