CandleVM Objects
Objects are data structures stored in the heap. They are referenced by ObjectRef values, which hold an object identifier used by the virtual machine to access the corresponding object in the heap.
An ObjectRef does not contain the object itself; it contains a reference to it. This allows objects to be accessed through references held in virtual machine values.
Object types
Array
Array represents an ordered collection of Values. Its elements can be accessed by their index.
Its type discriminator is 0.
Map
Map represents a collection of key-value pairs, allowing Values to be associated with and retrieved by their keys.
Its type discriminator is 1.
String
String represents a sequence of Chars.
Its type discriminator is 2.
Error
Error represents an error value that can hold information about a Candle error.
Its type discriminator is 3.
Buffer
Buffer represents a sequence of Bytes, allowing binary data to be stored and manipulated in an optimized way.
Its type discriminator is 4.
Closure
Closure represents a function together with its captured environment, allowing it to access Values from the context in which it was created.
Its type discriminator is 5.
Native Not instantiable from bytecode
Native represents an object provided by the host runtime, typically used to expose native functionality to CandleVM programs. It cannot be instantiated directly from bytecode.
Its type discriminator is 6.