Keys and values


Integer caching

If we set \(x=2\) we can either create \(2\) in memory, or simply point \(x\) to \(2\), which is already in memory

That means if we do \(x=2\) \(y=2\) they have the same pointer.

Can also cache some other common data values, eg empty lists.

Makes sense if pointer is smaller in memory than value.

Representing objects

Representing a single object

Null in objects

Representing a class with a multiple array (ie 2d)

Representing a class with a single array (ie 1d)

Functions with objects

Creating new objects

Getting values by field

Adding fields

Changing values in fields

Hierarchies of objects