Object-Oriented Programming

Object-oriented programming is done like this:

let OO := requireModule "OO" in 
import [Object wrap! (class)] from OO in 
let Widget := class
	...
	(requireModule "Composition").dispatch (#exports[])
	Object
in 
let Button := class
	let click! := \self
		...
	in
	let new! := allocatePointer! ;\ptr
		...
		wrap! ptr
	in 
	(requireModule "Composition").dispatch (#exports[click! new!])
	Widget
in

Object

The Object from which all other Objects are derived.

class

Identity function in order to make people feel comfortable.

wrap \class \instance

Given a class and an instance, results in a dispatcher for that class and instance.

wrap! \class \instance

Eventually does: Given a class and an instance, results in a dispatcher for that class and instance.