diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-22 12:08:10 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-22 12:08:10 -0700 |
commit | ada5eb55cb185edf30dcac48b25cc485d44677ef (patch) | |
tree | e147838f053a582e33146ac4fc4ab30ac8434e0e /edit/005-sandbox.mu | |
parent | a6deb48067f8049922f16ed3489896f7749fd39f (diff) | |
download | mu-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 'edit/005-sandbox.mu')
-rw-r--r-- | edit/005-sandbox.mu | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu index 1b9343a5..bc0488f7 100644 --- a/edit/005-sandbox.mu +++ b/edit/005-sandbox.mu @@ -137,7 +137,7 @@ after <global-keypress> [ screen <- update-status screen, [ ], 245/grey } screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env - loop +next-event:label + loop +next-event } ] @@ -380,7 +380,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 { @@ -399,7 +399,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 @@ -706,7 +706,7 @@ after <global-keypress> [ break-unless at-bottom-of-editor? more-to-scroll?:bool <- more-to-scroll? env, screen break-if more-to-scroll? - loop +next-event:label + loop +next-event } { break-if sandbox-in-focus? @@ -714,7 +714,7 @@ after <global-keypress> [ break-unless page-down? more-to-scroll?:bool <- more-to-scroll? env, screen break-if more-to-scroll? - loop +next-event:label + loop +next-event } ] @@ -725,7 +725,7 @@ after <global-type> [ break-unless page-down? more-to-scroll?:bool <- more-to-scroll? env, screen break-if more-to-scroll? - loop +next-event:label + loop +next-event } ] @@ -863,14 +863,14 @@ after <global-keypress> [ number-of-sandboxes:num <- get *env, number-of-sandboxes:offset max:num <- subtract number-of-sandboxes, 1 at-end?:bool <- greater-or-equal render-from, max - jump-if at-end?, +finish-event:label # render nothing + jump-if at-end?, +finish-event # render nothing render-from <- add render-from, 1 *env <- put *env, render-from:offset, render-from } hide-screen screen screen <- render-sandbox-side screen, env, render show-screen screen - jump +finish-event:label + jump +finish-event } ] @@ -901,7 +901,7 @@ after <global-keypress> [ hide-screen screen screen <- render-sandbox-side screen, env, render show-screen screen - jump +finish-event:label + jump +finish-event } ] |