summary refs log tree commit diff stats
path: root/doc/manual_experimental.md
diff options
context:
space:
mode:
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
tter Araq <rumpf_a@web.de> 2013-05-19 23:17:16 +0200 made some tests green; implemented 'from module import nil'' href='/ahoang/Nim/commit/copying.txt?h=devel&id=1c9b4e5d33ff6bca8f345951b72018171d47e251'>1c9b4e5d3 ^
c5d7f6d2b ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24