Data
Data; it's structure, formatting and storage.
Large Uint
A uint is a byte slice.
(data uint) LoadUint(l uint) (this uint, rest uint) {
if l==0{
b = data[0]
if b < 129 {
return b, data[1:]
}
if b < 252 {
return data[1:b-250], data[b-250:]
}
return LoadUint(b-251)
}
return data[1:l+1], data[l+1:]
}
Fundamental Structures
Value
A type and bytes where the type indicates how to interpret the bytes.
Array
An ordered list, all of the same type.
Tagged Union
One of a set of types with a tag indicating the type.
Tuple
An ordered list where the tuple type defines the length and the type of each element.
Struct
An unordered list where each element has a tag and a type.
Associative Array
An unordered list where each element has key and value.
Mono Container
I think I can represent all these types with a single container.
- Key Type
- Ordered: The key is an int taken from the position, an ordered list
- Type: The keys all have the same type.
- Key Value
- Direct : The data will define the key value directly
- Indirect : The data will define a location to get the key value.
- Value Type
- None : The data will define the value type
- Lookup : The combination of ContainerType, KeyType and KeyValue provides a lookup - not sure how to make this work.
- Type : All the data has the same type.
An important feature is the ability to read data from a shared context. But this requires collision avoidance so the keys in a shared context are large. We don't want these large values repeated in the data, so there is an operation to read from the shared context into a register.