Typechecking

- Documented exact types or type equality
This commit is contained in:
Tristan B. Velloza Kildaire 2023-07-08 12:18:42 +02:00
parent 07fca41966
commit 6004a429d3
1 changed files with 10 additions and 2 deletions

View File

@ -213,9 +213,17 @@ digraph CodequeueProcess {
Enforcement is the procedure of ensuring that a given `Value`-based instruction, $instr_{i}$, conforms to the target type or _"to-type"_, $type_{i}$. An optional flag can be passed such that if the $typeof(instr_{i}) \neq type_{i}$ that it can then attempt coercion as to bring it to the equal type.
#### TODO: isSameType
The method by which this is done is:
TODO: Document isSameTYpe
```d
typeEnforce(Type toType, Value v2, ref Instruction coercedInstruction, bool allowCoercion = false)
```
#### Type equality
In order to check strict equality the type enforcer will initially check the following condition. We label the `toType` as $t_{1}$ and the the type of `v2` as $typeof(v_{2})$ (otherwise referred to as $t_{2}$).
The method `isSameType(Type t1, Type t2)` provides exact quality checking between the two given types in the form of $t_{1} = t_{2}$.
#### Coercion