diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-11-19 16:51:42 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-12-15 10:20:41 -0800 |
commit | cc4b1029669dcf58b2faee74656858c1be923142 (patch) | |
tree | 8806e4d18b268ea7b77bf61945667c20968069b1 | |
parent | b1bb6e538ffd54a7fc10ed915ac3a0ad50a7a1e1 (diff) | |
download | mu-cc4b1029669dcf58b2faee74656858c1be923142.tar.gz |
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.
-rw-r--r-- | 073list.mu | 10 | ||||
-rw-r--r-- | 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 |