about summary refs log tree commit diff stats
path: root/045closure_name.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-25 20:33:37 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-25 21:36:46 -0700
commitb2757892d553352feb59d70b1e7241ccdafa6905 (patch)
tree5a7597e46daf2db17d2fc5ade66aef3f07c261ce /045closure_name.cc
parent64ac91c564a20e2ebf19ad211e987fbfc7fb2719 (diff)
downloadmu-b2757892d553352feb59d70b1e7241ccdafa6905.tar.gz
1458
While pushing out color support in fake screens I realized I've been
complecting the special-case of a special-case to transform
literal-string arguments for 'new'. As a result I hadn't been catching
bad habits like giving its arg the wrong type. Now we have cleaner
separation of the two variants of 'new', a few more checks, and better
error messages when we mis-call it.

Aside: I've added a third goto target. Sliding into spaghetti? Keep an
eye on it.

This goto might become a common pattern: a layer hooking into a previous
one to prevent it from happening. In this case new on literal-strings
prevents the transform for new from triggering.
Diffstat (limited to '045closure_name.cc')
-rw-r--r--045closure_name.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/045closure_name.cc b/045closure_name.cc
index 237eee3c..66696fc6 100644
--- a/045closure_name.cc
+++ b/045closure_name.cc
@@ -21,7 +21,7 @@ recipe init-counter [
 ]
 
 recipe increment-counter [
-  default-space:address:array:location <- new space:literal, 30:literal
+  default-space:address:array:location <- new location:type, 30:literal
   0:address:array:location/names:init-counter <- next-ingredient  # outer space must be created by 'init-counter' above
   y:number/space:1 <- add y:number/space:1, 1:literal  # increment
   y:number <- copy 234:literal  # dummy