about summary refs log tree commit diff stats
path: root/073list.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-19 16:51:42 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-12-15 10:20:41 -0800
commitcc4b1029669dcf58b2faee74656858c1be923142 (patch)
tree8806e4d18b268ea7b77bf61945667c20968069b1 /073list.mu
parentb1bb6e538ffd54a7fc10ed915ac3a0ad50a7a1e1 (diff)
downloadmu-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.
Diffstat (limited to '073list.mu')
-rw-r--r--073list.mu10
1 files changed, 4 insertions, 6 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