negative eigenclasses.
Since terminal objects do not have instance prototypes, each object is a descendant of the inheritance root in (Θ, ≤). This allows for a prototypal interpretation of inheritance, as known from the JavaScript programming language. As a consequence, under the additional assumption of single inheritance, object membership with prototypes can be implemented in JavaScript, directly leveraging the native prototypal inheritance. Such an implementation is provided in this document.
Finally, the native
JavaScript structure, formed by links corresponding to the
__proto__
, constructor
and prototype
properties,
is described.
Author
|
Document date
|
(Θ, ϵ) is an S1ϵ structure that does not have terminal objects. | |
Θ.ec.↧ ⊆ O. (That is, eigenclasses of (Θ, ϵ) and their descendants are in O.) | |
For every object x from the difference
O ∖ Θ.ec.↧,
|
Proposition A:
|
|
Proposition B:
inheritedfrom prototypes.
Metalevel index | 0 |
> | 1 |
> | 2, 3, … |
|
Nomenclature | Prototypes | Classes | Eigenclasses | |||
Expression | H.class.ce | H.class | H.ec(2) | |||
Highest object | r.ce | r | r.ec | |||
∶ | ∶ | ∶ | ∶ | |||
Lowest object | c.ce | c | — |
Proposition: The instance-of relation in S1ȷ structures satisfies the following conditions:
Note:
In JavaScript,
the native core structure
implements ≤' instead of ≤.
The (b) condition is used for the interpretation of the instanceof
operator.
Inheritance, ≤, is a partial order. | |
The maps .class and .ce
form a Galois connection between (Θ.c, ≤)
and (C, ≤),
i.e.
for every object x and class y,
| |
The .ce map is injective, i.e. different classes have different instance prototype. | |
Terminals are minimal in inheritance. | |
Classes and instance prototypes are disjoint sets. | |
Helix objects satisfy the following properties:
| |
The set C ∖ H.c of non-helix classes forms a down-set in inheritance. | |
The set C of classes is finite. |
Proposition:
Ruby-likewe mean that the structure satisfies the following additional restrictions:
Class < Object < BasicObject
Module
class between Class
and Object
.)
Blue arrows indicate the class map in the restriction to prototypes.
On the remaining objects x, the .class map is inherited:
x.class equals y.class where y
is the least ancestor of x that is a prototype.
(For classes x, y is always equal to c.ce.)
|
r = BasicObject c = Class A = Class.NEW() B = Class.NEW(A) s = A.NEW() u = B.NEW() v = B.NEW() |
NEW
(uppercase)
is used instead of new
(lowercase).
This is because the code is also a valid JavaScript code that uses a NEW
method for creating instances (rather than the built-in new
operator).
The NEW
method belongs to the library described in the next section.
The library
implements creation and introspection of
S1ȷ structures with single inheritance.
r
rather than BasicObject
.
Likewise,
user classes and terminals are reported by the names of the local variables
that refer to them.