lovm2 embraces dynamic typing. The most basic ones are
Nil is the default return type of functions that do not have return values. You can also use it to mark the absence of a value.
Ref can wrap any other value and implement a shared mutable location as such.
Dict are a bit more complicated, because they need to store other values. As such, they support the
These types also utilize
Ref heavily. If you use the standard
lovm2 functionality for generating programs, you will always implicitly work with a
Ref to the corresponding data. The virtual machine also ensures that every value being stored inside these types is itself wrapped up in a reference. This is required for the implementation of slices. The
Box instruction realizes this functionality.
Another special value kind is
Any. This type is used for allowing external shared object modules to pass their custom Rust structures into the VM.
Conv instruction is able to convert data according to the following rules:
|from / to||Nil||Bool||Int||Float||String||List||Dict||Ref|
~: implies parsing overhead