Archetypes
The shape you make instances of — the concept the language is named after.
Everything you have written so far fit inside a single object: one instance, some methods, and
start to orchestrate it all. Section 1.2 promised the other half — “the type with several
instances, the language’s central concept, which we will meet”. This is it.
An archetype is a shape; the program makes instances of it, each with its own values. This section lays down the philosophy of the concept, then the shape, the state, and the constructor.
In this section
- 7.1The philosophy
What an archetype is, and why the whole language carries its name.
- 7.2A shape, and its instances
archetype declares the shape; the program makes as many instances of it as it wants.
- 7.3State, and self
An archetype's methods work on the instance that calls them — self is that one.
- 7.4The constructor
When building is more than copying fields — code that runs at birth.