TypeChecking

- Fixed some typos here and there
This commit is contained in:
Tristan B. Velloza Kildaire 2023-07-09 15:50:34 +02:00
parent 2a83a653d5
commit 2a015a60bb
2 changed files with 9 additions and 11 deletions

View File

@ -144,15 +144,13 @@ the same as $type_{i} = typeof(coerceInstr_{i})$), valid.
TODO: Document this now
Coercion has a set of rules (TODO: docuemnt them) in terms of what can
Coercion has a set of rules (TODO: document them) in terms of what can
be coerced. AT the end of the day if the coercion fails then a
`CoercionException` is thrown, if, however it succeeds then a
`CastedValueInstruction` will be placed into the memory location (the
variable) pointed to by the `ref` parameter of
`typeEnforce(..., ..., ref Instruction coercedInstruction, true)`.
TODO: Document the usage of this for variable assignments for example
##### Example
Below we have an example of the code which processes variable
@ -186,17 +184,17 @@ if(variablePNode.getAssignment())
What the above code is doing is:
1. Firstly popping off an `Instruction` from the stack-queue and then
downcasting it to `Value` (for `Value`-based instructions would be
down-casting it to `Value` (for `Value`-based instructions would be
required as an *expression* is being assigned)
2. We then call `typeEnforce()` providing it with: \* The variables
type - the `variableDeclarationType` \* The incoming `Value`-based
instruction `assignmentInstr` \* The third argument, is `ref`-based,
meaning what we provide it is the variable which will have the
result of the enforcement (if coercion is required) placed into \*
The last argument is `true`, meaning *“Please attemt coercion if the
types are not exactly equal, please”*
The last argument is `true`, meaning *“Please attempt coercion if
the types are not exactly equal, please”*
The last line ocnatining an asssertion:
The last line containing an assertion:
``` d
assert(isSameType(

View File

@ -236,7 +236,7 @@ In the case of coercion an application of $coerce()$ is applied to the incoming
TODO: Document this now
Coercion has a set of rules (TODO: docuemnt them) in terms of what can be coerced. AT the end of the day if the coercion fails then a `CoercionException` is thrown, if, however it succeeds then a `CastedValueInstruction` will be placed into the memory location (the variable) pointed to by the `ref` parameter of `typeEnforce(..., ..., ref Instruction coercedInstruction, true)`.
Coercion has a set of rules (TODO: document them) in terms of what can be coerced. AT the end of the day if the coercion fails then a `CoercionException` is thrown, if, however it succeeds then a `CastedValueInstruction` will be placed into the memory location (the variable) pointed to by the `ref` parameter of `typeEnforce(..., ..., ref Instruction coercedInstruction, true)`.
##### Example
@ -269,14 +269,14 @@ if(variablePNode.getAssignment())
What the above code is doing is:
1. Firstly popping off an `Instruction` from the stack-queue and then downcasting it to `Value` (for `Value`-based instructions would be required as an _expression_ is being assigned)
1. Firstly popping off an `Instruction` from the stack-queue and then down-casting it to `Value` (for `Value`-based instructions would be required as an _expression_ is being assigned)
2. We then call `typeEnforce()` providing it with:
* The variable's type - the `variableDeclarationType`
* The incoming `Value`-based instruction `assignmentInstr`
* The third argument, is `ref`-based, meaning what we provide it is the variable which will have the result of the enforcement (if coercion is required) placed into
* The last argument is `true`, meaning _"Please attemt coercion if the types are not exactly equal, please"_
* The last argument is `true`, meaning _"Please attempt coercion if the types are not exactly equal, please"_
The last line containing an asssertion:
The last line containing an assertion:
```{.d .numberLines}
assert(isSameType(