cx
cx copied to clipboard
[For Further Discussions] Better format for structs
CX Struct definition
One array vs N-arrays
CXStruct
- num fields
- field string
- field offset
- field size
- field type
- Type ID (CX atomic, cx atomic pointer, cx struct pointer, cx struct)
- Field
- If CX atomic then type id
- if struct pointer then pointer id
- if cxatomic pointer then the type of the cx atomic
CXStruct Definition
- A struct
- the variable layout of a function
- the inputs to a function
- the outputs of a function
- It has the same layout format as a “struct” definition
Is there a “dynamic variable” struct that can define other types at runtime?
TypeID
- CXAtomic
- CXAtomicPointer
- CXStruct
- CXStructPointer
- CXArray
- CXArrayPointer
- etc TypeField
- If CXAtomic, then CXAtomic type
- if StructPointer, then the pointer id
- If CXAtomicPointer, then the type of CXAtomic
- etc Ptr to data/object in theory any operation on fixxed data can now occur on an atomic data
— Arrays of TypeID and TypeFIeld is enough to define a CXFunction, input and output and the packing of variables in function bodies
CXStruct Definition
- Type Signatures
- StructFields/Elements/“slots”
- variable type
- the misc mets identifier
- Data layout/offsets
- Byte offsets for each data field in a struct
- Byte offsets for each data field/variable in a cx function
- Inputs to a function/signature
- Outputs of a function/signature