object is a unit of state and behaviors. if you think about a class hierarchy then an objects state is its instance variables and its behaviors are all the methods defined on the classes it inherits from. an object without knowledge of the objects that describe it is useless.
in a local running simulation you know that all the data of your program lives in your computers memory. this is fine for local objects but can we describe an object that lives on a network node, where accessing data is costly or limited? if the network is represented by a local data object, and already objects are made of other objects, then an object who's data lives far far away can be referred to with a handle. a handle is two parts of data with a space and location, similar to a street address or a URL. 123 Mayweather the space is mayweather street where the number 123 refers to one house in particular. file:///bin the space is the filesystem where "/bin" has meaning, http://porn.xxx porn.xxx only works in the domain of http unless you have permission to access their ftp.
an object is a space and an identifier that has meaning only in that space (the same identifier probably has meaning in other spaces) a space is an object that interprets an identifier
- the space manages the objects data
- a space is itself a member of a space
a space has a parent necessary to interpret its data like any other object.
- some object according to
- some space according to
- some space according to..
- some space according to
in my implementation the obj type is declared like this: struct obj { struct obj* space, int id; };
where do spaces ultimately live then? in another space, or in theirself. numbered objects can have their own space.
- at the start of the program many basic types are defined to hold raw structured data, these are given a number as they are defined so we might give them their own "static data type space", later when static types are loaded from modules they can be managed by spaces in a similar way
- since id is an int a space can be used that provides behaviors to interpret its id as it's int value
- since a pointer can be NULL (0) we can define that as a valid space (or rather, instead of failing on a null pointer deref we can make use of the null state)
- a refcounting space can be used to track local objects
- a network space might hold all of its members to a specific api similar to int space, the methods it provides will return futures/promises
an object is a resource that you request from its space, it could also refer to open files or memory handles outside the system. space is in charge of the petty details of memory management. a resource can be closed automagically when the last reference to it is dropped.
example objects by (space,id)
int = intspace
static = static space where static data types (and variables?) live
0 = global space (an instance of a local data space indicated by a null ptr)
heap = live object space where most local objects live (refcounted internally)
(int,0)
= number 0,
(int,1)
= number 1
(0,0)
= nil global object, uninitialized/undefined object,
(0,1)
= global space, reference to space 0 in itself
(static,0)
= first static obj defined,
(heap,...)
= most local objs live here
in order to create an object it must be requested from a space via message.
requesting a user handle might look like:
Users byName: 'Bob'
Users is a network space, it has a message that accepts a local string, turning it into some bytes to send over a network and returns a Promise