about summary refs log tree commit diff stats
path: root/sandbox/005-sandbox.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-10-22 12:08:10 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-10-22 12:08:10 -0700
commitada5eb55cb185edf30dcac48b25cc485d44677ef (patch)
treee147838f053a582e33146ac4fc4ab30ac8434e0e /sandbox/005-sandbox.mu
parenta6deb48067f8049922f16ed3489896f7749fd39f (diff)
downloadmu-ada5eb55cb185edf30dcac48b25cc485d44677ef.tar.gz
3552
Stop requiring jump instructions to explicitly provide a ':label' type
for jump targets.

This has been a source of repeated confusion for my students:
  a) They'd add the ':label' to the label definition rather than the
  jump target (label use)
  b) They'd spend time thinking about whether the initial '+' prefix was
  part of the label name.

In the process I cleaned up a couple of things:

  - the space of names is more cleanly partitioned into labels and
    non-labels (clarifying that '_' and '-' are non-label prefixes)
  - you can't use label names as regular variables anymore
  - you can infer the type of a label just from its name
Diffstat (limited to 'sandbox/005-sandbox.mu')
-rw-r--r--sandbox/005-sandbox.mu10
1 files changed, 5 insertions, 5 deletions
diff --git a/sandbox/005-sandbox.mu b/sandbox/005-sandbox.mu
index 45dc259c..7787b50c 100644
--- a/sandbox/005-sandbox.mu
+++ b/sandbox/005-sandbox.mu
@@ -118,7 +118,7 @@ after <global-keypress> [
       screen <- update-status screen, [                 ], 245/grey
     }
     screen <- update-cursor screen, current-sandbox, env
-    loop +next-event:label
+    loop +next-event
   }
 ]
 
@@ -366,7 +366,7 @@ def render-text screen:&:screen, s:text, left:num, right:num, color:num, row:num
       column <- copy left
       row <- add row, 1
       screen <- move-cursor screen, row, column
-      loop +next-character:label  # retry i
+      loop +next-character  # retry i
     }
     i <- add i, 1
     {
@@ -385,7 +385,7 @@ def render-text screen:&:screen, s:text, left:num, right:num, color:num, row:num
       row <- add row, 1
       column <- copy left
       screen <- move-cursor screen, row, column
-      loop +next-character:label
+      loop +next-character
     }
     print screen, c, color
     column <- add column, 1
@@ -708,7 +708,7 @@ after <global-keypress> [
     hide-screen screen
     screen <- render-sandbox-side screen, env, render
     show-screen screen
-    jump +finish-event:label
+    jump +finish-event
   }
 ]
 
@@ -737,7 +737,7 @@ after <global-keypress> [
     hide-screen screen
     screen <- render-sandbox-side screen, env, render
     show-screen screen
-    jump +finish-event:label
+    jump +finish-event
   }
 ]