Updated Destructors (rest)

This commit is contained in:
Andreas Rumpf 2018-01-04 13:03:09 +01:00
parent 64917905e9
commit d6743cda74
1 changed files with 3 additions and 3 deletions

View File

@ -5,15 +5,15 @@ Nim's strings and sequences should become "GC-free" implementations and are exem
Rewrite rules (simplified)
==========================
-------- -------------------- -----------------------------------------------------------
======== ==================== ===========================================================
Rule Pattern Meaning
-------- -------------------- -----------------------------------------------------------
======== ==================== ===========================================================
1 var x; stmts var x; try stmts finally: `=destroy`(x)
2 x = f() `=sink`(x, f())
3 x = lastReadOf z `=sink`(x, z)
4 x = y `=`(x, y) # a copy
5 f(g()) var tmp; `=sink`(tmp, g()); f(tmp); `=destroy`(tmp)
-------- -------------------- -----------------------------------------------------------
======== ==================== ===========================================================
Rule (5) can be optimized further to ``var tmp = bitwiseCopy(g()); f(tmp); =destroy(tmp)``.