TypeChecking
- Added the mathematics behind the coercion function
This commit is contained in:
parent
ae9cf2de84
commit
6d0750cf73
|
@ -104,6 +104,21 @@ This would result in a situation where we have the following production
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
### Type checking, coercion and enforcement
|
### Enforcement
|
||||||
|
|
||||||
|
$A_{1},\,A_{2}\ldots A_{n}$
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
In the case of coercion an application of $coerce()$ is applied to the
|
||||||
|
incoming instruction, as to produce an instruction $coerceInstr_{i}$, a
|
||||||
|
`CastedValueInstruction`, which wraps the original instruction inside of
|
||||||
|
it but allows for a type cast/conversion to the target type, therefore
|
||||||
|
making the statement, $type_{i} = typeof(coerce(instr_{i}))$ (which is
|
||||||
|
the same as $type_{i} = typeof(coerceInstr_{i})$), valid.
|
||||||
|
|
||||||
TODO: Document this now
|
TODO: Document this now
|
||||||
|
|
|
@ -209,6 +209,18 @@ digraph CodequeueProcess {
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Type checking, coercion and enforcement
|
### Enforcement
|
||||||
|
|
||||||
|
$A_{1},\,A_{2}\ldots A_{n}$
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
TODO: Document isSameTYpe
|
||||||
|
|
||||||
|
#### Coercion
|
||||||
|
|
||||||
|
In the case of coercion an application of $coerce()$ is applied to the incoming instruction, as to produce an instruction $coerceInstr_{i}$, a `CastedValueInstruction`, which wraps the original instruction inside of it but allows for a type cast/conversion to the target type, therefore making the statement, $type_{i} = typeof(coerce(instr_{i}))$ (which is the same as $type_{i} = typeof(coerceInstr_{i})$), valid.
|
||||||
|
|
||||||
TODO: Document this now
|
TODO: Document this now
|
Loading…
Reference in New Issue