From d6743cda74e98b3f4df8cf2f5586a1481d13235d Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Thu, 4 Jan 2018 13:03:09 +0100 Subject: [PATCH] Updated Destructors (rest) --- Destructors.rest | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Destructors.rest b/Destructors.rest index 924eff6..d27e08a 100644 --- a/Destructors.rest +++ b/Destructors.rest @@ -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)``.