From cc4b1029669dcf58b2faee74656858c1be923142 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 19 Nov 2015 16:51:42 -0800 Subject: start using the new check I wasn't seeing errors because I wasn't using /contained-in in products yet. But it seems to work fine even after. One reason this isn't an invasive change is that it's opt-in. Most of the time it isn't triggered. You have to add the /contained-in check to trigger a check. But that's just like regular const checks in other languages: if you don't specify immutability you get no checks. --- 073list.mu | 10 ++++------ 075duplex_list.mu | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/073list.mu b/073list.mu index 6f27a7a8..9881d85b 100644 --- a/073list.mu +++ b/073list.mu @@ -8,16 +8,15 @@ container list:_elem [ next:address:list:_elem ] -# should I say in/contained-in:result, allow ingredients to refer to products? -recipe push x:_elem, in:address:list:_elem -> result:address:list:_elem [ +recipe push x:_elem, in:address:list:_elem -> in:address:list:_elem [ local-scope load-ingredients - result <- new {(list _elem): type} + result:address:list:_elem <- new {(list _elem): type} val:address:_elem <- get-address *result, value:offset *val <- copy x next:address:address:list:_elem <- get-address *result, next:offset *next <- copy in - reply result + reply result # needed explicitly because we need to replace 'in' with 'result' ] recipe first in:address:list:_elem -> result:_elem [ @@ -26,8 +25,7 @@ recipe first in:address:list:_elem -> result:_elem [ result <- get *in, value:offset ] -# result:address:list <- rest in:address:list -recipe rest in:address:list:_elem -> result:address:list:_elem [ +recipe rest in:address:list:_elem -> result:address:list:_elem/contained-in:in [ local-scope load-ingredients result <- get *in, next:offset diff --git a/075duplex_list.mu b/075duplex_list.mu index 1f00a0cf..317fa1ac 100644 --- a/075duplex_list.mu +++ b/075duplex_list.mu @@ -30,14 +30,14 @@ recipe first in:address:duplex-list:_elem -> result:_elem [ result <- get *in, value:offset ] -recipe next in:address:duplex-list:_elem -> result:address:duplex-list:_elem [ +recipe next in:address:duplex-list:_elem -> result:address:duplex-list:_elem/contained-in:in [ local-scope load-ingredients reply-unless in, 0 result <- get *in, next:offset ] -recipe prev in:address:duplex-list:_elem -> result:address:duplex-list:_elem [ +recipe prev in:address:duplex-list:_elem -> result:address:duplex-list:_elem/contained-in:in [ local-scope load-ingredients reply-unless in, 0 -- cgit 1.4.1-2-gfad0