Vladislav Folts 11 лет назад
Родитель
Сommit
17694904b6

+ 1 - 1
doc/wiki/eberon-implicit-type-narrowing.md

@@ -17,7 +17,7 @@ Original Oberon-07 has no facility for runtime type testing combined with type c
 
 As you can see here there are two separate operations - type test and then type cast. *Implicit type narrowing* is introduced to resolve this problem.
 
-The idea of *implicit type narrowing* is to make the compiler smart enough to comprehend that type testing (using IS) and following IF branch or logical conjunction (&) in expression narrows just tested variable type. The same type narrowing happens in the inverse case: logical not (~) for IS operation and following ELSE branch or logical disjunction (OR). Also compiler should guarantee that tested variable is not modified after type narrowing so there is no loopholes to corrupt type system by chance. That guarantee is easy to reach in case of [In Place Variables](/vladfolts/oberonjs/wiki/eberon-in-place-variables) because their scope is very local and they cannot be modified by local procedures. So if the example will use *pb* variable as *in place* variable then it will be compiled without addition type casts:
+The idea of *implicit type narrowing* is to make the compiler smart enough to comprehend that type testing (using IS) and following IF branch or logical conjunction (&) in expression narrows just tested variable type. The same type narrowing happens in the inverse case: logical not (~) for IS operation and following ELSE branch or logical disjunction (OR). Also compiler should guarantee that tested variable is not modified after type narrowing so there is no loopholes to corrupt type system by chance. That guarantee is easy to reach in case of [[In Place Variables|eberon-in-place-variables]] because their scope is very local and they cannot be modified by local procedures. Type narrowing is also appling to procedure arguments because they [[cannot be modified|Eberon-non-VAR-arguments-are-read-only]]. So if the example will use *pb* variable as *in place* variable then it will be compiled without addition type casts:
 
     VAR
         pbVar: PBase;

+ 2 - 0
doc/wiki/eberon-non-VAR-arguments-are-read-only.md

@@ -0,0 +1,2 @@
+Original Oberon-O7 allows to change procedure arguments (to use them as ordinary variables) unless they are non-VAR ARRAY or RECORD. Eberon makes this rule more consistent - all non-VAR arguments are read-only.
+This restriction is introduced in the first place to support [[implicit type narrowing|eberon-implicit-type-narrowing]] for POINTER arguments. But anyway reusing arguments as variables I personally consider as a bad practice because their scope is a whole procedure and possibility of modifing requires more attention while reading.

+ 11 - 8
doc/wiki/eberon.md

@@ -1,12 +1,15 @@
 **Eberon** is Experimental oBERON. It is my attempt to make a programming language in the right way (in my humble opinion of cause) taking Wirth's Oberon as a start point.
 
-Eberon extends original Oberon so any valid oberon program is also a valid eberon program. A new syntax was introduced for extensions but I tried to maintain the original syntax flavor (e.g. CAPS).
+Eberon basically extends original Oberon (excluding additional [restrictions](#restrictions) below) so any valid oberon program is also a valid eberon program. A new syntax was introduced for extensions but I tried to maintain the original syntax flavor (e.g. CAPS).
 
 ### Extensions
-* [Methods](/vladfolts/oberonjs/wiki/eberon-methods)
-* [Strings](/vladfolts/oberonjs/wiki/eberon-strings)
-* [In Place Variables](/vladfolts/oberonjs/wiki/eberon-in-place-variables)
-* [Implicit Type Narrowing](/vladfolts/oberonjs/wiki/eberon-implicit-type-narrowing)
-* [Record fields read-only export](/vladfolts/oberonjs/wiki/eberon-record-fields-read-only-export)
-* [Procedure call result can be denoted](/vladfolts/oberonjs/wiki/eberon-procedure-call-result)
-* Non-scalar variables (arrays and records) can be exported (forbidden in oberon for some unknown reason).
+* [[Methods|eberon-methods]]
+* [[Strings|eberon-strings]]
+* [[In Place Variables|eberon-in-place-variables]]
+* [[Implicit Type Narrowing|eberon-implicit-type-narrowing]]
+* [[Record fields read-only export|eberon-record-fields-read-only-export]]
+* [[Procedure call result can be denoted|eberon-procedure-call-result]]
+* Non-scalar variables (arrays and records) can be exported (forbidden in oberon for some unknown reason).
+
+### Restrictions
+* [[Non-VAR arguments are read-only|eberon-non-VAR-arguments-are-read-only]]