summary refs log tree commit diff stats
path: root/doc/manual_experimental.md
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2022-12-11 16:58:50 +0100
committerGitHub <noreply@github.com>2022-12-11 16:58:50 +0100
commit3812d91390633113061ceb2b4f3fc61f563a66fb (patch)
treedec2f281a74a39f19c6c42a03eb92d540adc037a /doc/manual_experimental.md
parentc7493bbdd0a9b8d63d6851971f2294923cf2e3a7 (diff)
downloadNim-3812d91390633113061ceb2b4f3fc61f563a66fb.tar.gz
alternative, much simpler algorithm for strict func checking (#21066)
* alternative, much simpler algorithm for strict func checking

* forgot to git add new compiler module

* new spec is incredibly simple to describe

* fixes bigints regression

* typos

* closes #16305; closes #17387; closes #20863
Diffstat (limited to 'doc/manual_experimental.md')
-rw-r--r--doc/manual_experimental.md16
1 files changed, 6 insertions, 10 deletions
diff --git a/doc/manual_experimental.md b/doc/manual_experimental.md
index a40dfedce..6f5906019 100644
--- a/doc/manual_experimental.md
+++ b/doc/manual_experimental.md
@@ -519,8 +519,7 @@ Since version 1.4, a stricter definition of "side effect" is available.
 In addition to the existing rule that a side effect is calling a function
 with side effects, the following rule is also enforced:
 
-Any mutation to an object does count as a side effect if that object is reachable
-via a parameter that is not declared as a `var` parameter.
+A store to the heap via a `ref` or `ptr` indirection is not allowed.
 
 For example:
 
@@ -540,15 +539,12 @@ For example:
       it = it.ri
 
   func mut(n: Node) =
-    let m = n # is the statement that connected the mutation to the parameter
-    m.data = "yeah" # the mutation is here
-    # Error: 'mut' can have side effects
-    # an object reachable from 'n' is potentially mutated
-  ```
-
+    var it = n
+    while it != nil:
+      it.data = "yeah" # forbidden mutation
+      it = it.ri
 
-The algorithm behind this analysis is described in
-the [view types algorithm][Algorithm].
+  ```
 
 
 View types