about summary refs log tree commit diff stats
path: root/edit/002-typing.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-17 13:25:40 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-17 13:25:40 -0700
commit3d8b137c879c6f5c01588c2dbbb35bc0ec028909 (patch)
treeb00800b9fb00b422b3eaf5acb02f1667ad62fbc7 /edit/002-typing.mu
parenta0331a9b0eab63a000dcd022fe605d124c573b8d (diff)
downloadmu-3d8b137c879c6f5c01588c2dbbb35bc0ec028909.tar.gz
3391 - type abbreviations everywhere
Well, almost. I can't use them in some places in C++ where I'm just
creating a temporary reagent without passing it through transforms. Like
in some unit tests. I can't use them in memory-should-contain.

And there's one remaining bug: I can't use abbreviations in a couple of
places in 075channel.mu.
Diffstat (limited to 'edit/002-typing.mu')
-rw-r--r--edit/002-typing.mu416
1 files changed, 208 insertions, 208 deletions
diff --git a/edit/002-typing.mu b/edit/002-typing.mu
index d81cc991..08e82ad7 100644
--- a/edit/002-typing.mu
+++ b/edit/002-typing.mu
@@ -6,26 +6,26 @@ def! main text:text [
   local-scope
   load-ingredients
   open-console
-  editor:address:editor-data <- new-editor text, 0/screen, 5/left, 45/right
+  editor:&:editor-data <- new-editor text, 0/screen, 5/left, 45/right
   editor-event-loop 0/screen, 0/console, editor
   close-console
 ]
 
-def editor-event-loop screen:address:screen, console:address:console, editor:address:editor-data -> screen:address:screen, console:address:console, editor:address:editor-data [
+def editor-event-loop screen:&:screen, console:&:console, editor:&:editor-data -> screen:&:screen, console:&:console, editor:&:editor-data [
   local-scope
   load-ingredients
   {
     # looping over each (keyboard or touch) event as it occurs
     +next-event
-    cursor-row:number <- get *editor, cursor-row:offset
-    cursor-column:number <- get *editor, cursor-column:offset
+    cursor-row:num <- get *editor, cursor-row:offset
+    cursor-column:num <- get *editor, cursor-column:offset
     screen <- move-cursor screen, cursor-row, cursor-column
-    e:event, console:address:console, found?:boolean, quit?:boolean <- read-event console
+    e:event, console:&:console, found?:bool, quit?:bool <- read-event console
     loop-unless found?
     break-if quit?  # only in tests
     trace 10, [app], [next-event]
     # 'touch' event
-    t:touch-event, is-touch?:boolean <- maybe-convert e, touch:variant
+    t:touch-event, is-touch?:bool <- maybe-convert e, touch:variant
     {
       break-unless is-touch?
       move-cursor-in-editor screen, editor, t
@@ -34,7 +34,7 @@ def editor-event-loop screen:address:screen, console:address:console, editor:add
     # keyboard events
     {
       break-if is-touch?
-      screen, editor, go-render?:boolean <- handle-keyboard-event screen, editor, e
+      screen, editor, go-render?:bool <- handle-keyboard-event screen, editor, e
       {
         break-unless go-render?
         screen <- editor-render screen, editor
@@ -45,23 +45,23 @@ def editor-event-loop screen:address:screen, console:address:console, editor:add
 ]
 
 # process click, return if it was on current editor
-def move-cursor-in-editor screen:address:screen, editor:address:editor-data, t:touch-event -> in-focus?:boolean, editor:address:editor-data [
+def move-cursor-in-editor screen:&:screen, editor:&:editor-data, t:touch-event -> in-focus?:bool, editor:&:editor-data [
   local-scope
   load-ingredients
   return-unless editor, 0/false
-  click-row:number <- get t, row:offset
+  click-row:num <- get t, row:offset
   return-unless click-row, 0/false  # ignore clicks on 'menu'
-  click-column:number <- get t, column:offset
-  left:number <- get *editor, left:offset
-  too-far-left?:boolean <- lesser-than click-column, left
+  click-column:num <- get t, column:offset
+  left:num <- get *editor, left:offset
+  too-far-left?:bool <- lesser-than click-column, left
   return-if too-far-left?, 0/false
-  right:number <- get *editor, right:offset
-  too-far-right?:boolean <- greater-than click-column, right
+  right:num <- get *editor, right:offset
+  too-far-right?:bool <- greater-than click-column, right
   return-if too-far-right?, 0/false
   # position cursor
   <move-cursor-begin>
   editor <- snap-cursor screen, editor, click-row, click-column
-  undo-coalesce-tag:number <- copy 0/never
+  undo-coalesce-tag:num <- copy 0/never
   <move-cursor-end>
   # gain focus
   return 1/true
@@ -70,50 +70,50 @@ def move-cursor-in-editor screen:address:screen, editor:address:editor-data, t:t
 # Variant of 'render' that only moves the cursor (coordinates and
 # before-cursor). If it's past the end of a line, it 'slides' it left. If it's
 # past the last line it positions at end of last line.
-def snap-cursor screen:address:screen, editor:address:editor-data, target-row:number, target-column:number -> editor:address:editor-data [
+def snap-cursor screen:&:screen, editor:&:editor-data, target-row:num, target-column:num -> editor:&:editor-data [
   local-scope
   load-ingredients
   return-unless editor
-  left:number <- get *editor, left:offset
-  right:number <- get *editor, right:offset
-  screen-height:number <- screen-height screen
+  left:num <- get *editor, left:offset
+  right:num <- get *editor, right:offset
+  screen-height:num <- screen-height screen
   # count newlines until screen row
-  curr:address:duplex-list:character <- get *editor, top-of-screen:offset
-  prev:address:duplex-list:character <- copy curr  # just in case curr becomes null and we can't compute prev
+  curr:&:duplex-list:char <- get *editor, top-of-screen:offset
+  prev:&:duplex-list:char <- copy curr  # just in case curr becomes null and we can't compute prev
   curr <- next curr
-  row:number <- copy 1/top
-  column:number <- copy left
+  row:num <- copy 1/top
+  column:num <- copy left
   *editor <- put *editor, cursor-row:offset, target-row
-  cursor-row:number <- copy target-row
+  cursor-row:num <- copy target-row
   *editor <- put *editor, cursor-column:offset, target-column
-  cursor-column:number <- copy target-column
-  before-cursor:address:duplex-list:character <- get *editor, before-cursor:offset
+  cursor-column:num <- copy target-column
+  before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
   {
     +next-character
     break-unless curr
-    off-screen?:boolean <- greater-or-equal row, screen-height
+    off-screen?:bool <- greater-or-equal row, screen-height
     break-if off-screen?
     # update editor-data.before-cursor
     # Doing so at the start of each iteration ensures it stays one step behind
     # the current character.
     {
-      at-cursor-row?:boolean <- equal row, cursor-row
+      at-cursor-row?:bool <- equal row, cursor-row
       break-unless at-cursor-row?
-      at-cursor?:boolean <- equal column, cursor-column
+      at-cursor?:bool <- equal column, cursor-column
       break-unless at-cursor?
       before-cursor <- copy prev
       *editor <- put *editor, before-cursor:offset, before-cursor
     }
-    c:character <- get *curr, value:offset
+    c:char <- get *curr, value:offset
     {
       # newline? move to left rather than 0
-      newline?:boolean <- equal c, 10/newline
+      newline?:bool <- equal c, 10/newline
       break-unless newline?
       # adjust cursor if necessary
       {
-        at-cursor-row?:boolean <- equal row, cursor-row
+        at-cursor-row?:bool <- equal row, cursor-row
         break-unless at-cursor-row?
-        left-of-cursor?:boolean <- lesser-than column, cursor-column
+        left-of-cursor?:bool <- lesser-than column, cursor-column
         break-unless left-of-cursor?
         cursor-column <- copy column
         *editor <- put *editor, cursor-column:offset, cursor-column
@@ -130,7 +130,7 @@ def snap-cursor screen:address:screen, editor:address:editor-data, target-row:nu
     {
       # at right? wrap. even if there's only one more letter left; we need
       # room for clicking on the cursor after it.
-      at-right?:boolean <- equal column, right
+      at-right?:bool <- equal column, right
       break-unless at-right?
       column <- copy left
       row <- add row, 1
@@ -144,11 +144,11 @@ def snap-cursor screen:address:screen, editor:address:editor-data, target-row:nu
   }
   # is cursor to the right of the last line? move to end
   {
-    at-cursor-row?:boolean <- equal row, cursor-row
-    cursor-outside-line?:boolean <- lesser-or-equal column, cursor-column
-    before-cursor-on-same-line?:boolean <- and at-cursor-row?, cursor-outside-line?
-    above-cursor-row?:boolean <- lesser-than row, cursor-row
-    before-cursor?:boolean <- or before-cursor-on-same-line?, above-cursor-row?
+    at-cursor-row?:bool <- equal row, cursor-row
+    cursor-outside-line?:bool <- lesser-or-equal column, cursor-column
+    before-cursor-on-same-line?:bool <- and at-cursor-row?, cursor-outside-line?
+    above-cursor-row?:bool <- lesser-than row, cursor-row
+    before-cursor?:bool <- or before-cursor-on-same-line?, above-cursor-row?
     break-unless before-cursor?
     cursor-row <- copy row
     *editor <- put *editor, cursor-row:offset, cursor-row
@@ -161,39 +161,39 @@ def snap-cursor screen:address:screen, editor:address:editor-data, target-row:nu
 
 # Process an event 'e' and try to minimally update the screen.
 # Set 'go-render?' to true to indicate the caller must perform a non-minimal update.
-def handle-keyboard-event screen:address:screen, editor:address:editor-data, e:event -> screen:address:screen, editor:address:editor-data, go-render?:boolean [
+def handle-keyboard-event screen:&:screen, editor:&:editor-data, e:event -> screen:&:screen, editor:&:editor-data, go-render?:bool [
   local-scope
   load-ingredients
   go-render? <- copy 0/false
   return-unless editor
-  screen-width:number <- screen-width screen
-  screen-height:number <- screen-height screen
-  left:number <- get *editor, left:offset
-  right:number <- get *editor, right:offset
-  before-cursor:address:duplex-list:character <- get *editor, before-cursor:offset
-  cursor-row:number <- get *editor, cursor-row:offset
-  cursor-column:number <- get *editor, cursor-column:offset
-  save-row:number <- copy cursor-row
-  save-column:number <- copy cursor-column
+  screen-width:num <- screen-width screen
+  screen-height:num <- screen-height screen
+  left:num <- get *editor, left:offset
+  right:num <- get *editor, right:offset
+  before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
+  cursor-row:num <- get *editor, cursor-row:offset
+  cursor-column:num <- get *editor, cursor-column:offset
+  save-row:num <- copy cursor-row
+  save-column:num <- copy cursor-column
   # character
   {
-    c:character, is-unicode?:boolean <- maybe-convert e, text:variant
+    c:char, is-unicode?:bool <- maybe-convert e, text:variant
     break-unless is-unicode?
     trace 10, [app], [handle-keyboard-event: special character]
     # exceptions for special characters go here
     <handle-special-character>
     # ignore any other special characters
-    regular-character?:boolean <- greater-or-equal c, 32/space
+    regular-character?:bool <- greater-or-equal c, 32/space
     go-render? <- copy 0/false
     return-unless regular-character?
     # otherwise type it in
     <insert-character-begin>
-    editor, screen, go-render?:boolean <- insert-at-cursor editor, c, screen
+    editor, screen, go-render?:bool <- insert-at-cursor editor, c, screen
     <insert-character-end>
     return
   }
   # special key to modify the text or move the cursor
-  k:number, is-keycode?:boolean <- maybe-convert e:event, keycode:variant
+  k:num, is-keycode?:bool <- maybe-convert e:event, keycode:variant
   assert is-keycode?, [event was of unknown type; neither keyboard nor mouse]
   # handlers for each special key will go here
   <handle-special-key>
@@ -201,35 +201,35 @@ def handle-keyboard-event screen:address:screen, editor:address:editor-data, e:e
   return
 ]
 
-def insert-at-cursor editor:address:editor-data, c:character, screen:address:screen -> editor:address:editor-data, screen:address:screen, go-render?:boolean [
+def insert-at-cursor editor:&:editor-data, c:char, screen:&:screen -> editor:&:editor-data, screen:&:screen, go-render?:bool [
   local-scope
   load-ingredients
-  before-cursor:address:duplex-list:character <- get *editor, before-cursor:offset
+  before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
   insert c, before-cursor
   before-cursor <- next before-cursor
   *editor <- put *editor, before-cursor:offset, before-cursor
-  cursor-row:number <- get *editor, cursor-row:offset
-  cursor-column:number <- get *editor, cursor-column:offset
-  left:number <- get *editor, left:offset
-  right:number <- get *editor, right:offset
-  save-row:number <- copy cursor-row
-  save-column:number <- copy cursor-column
-  screen-width:number <- screen-width screen
-  screen-height:number <- screen-height screen
+  cursor-row:num <- get *editor, cursor-row:offset
+  cursor-column:num <- get *editor, cursor-column:offset
+  left:num <- get *editor, left:offset
+  right:num <- get *editor, right:offset
+  save-row:num <- copy cursor-row
+  save-column:num <- copy cursor-column
+  screen-width:num <- screen-width screen
+  screen-height:num <- screen-height screen
   # occasionally we'll need to mess with the cursor
   <insert-character-special-case>
   # but mostly we'll just move the cursor right
   cursor-column <- add cursor-column, 1
   *editor <- put *editor, cursor-column:offset, cursor-column
-  next:address:duplex-list:character <- next before-cursor
+  next:&:duplex-list:char <- next before-cursor
   {
     # at end of all text? no need to scroll? just print the character and leave
-    at-end?:boolean <- equal next, 0/null
+    at-end?:bool <- equal next, 0/null
     break-unless at-end?
-    bottom:number <- subtract screen-height, 1
-    at-bottom?:boolean <- equal save-row, bottom
-    at-right?:boolean <- equal save-column, right
-    overflow?:boolean <- and at-bottom?, at-right?
+    bottom:num <- subtract screen-height, 1
+    at-bottom?:bool <- equal save-row, bottom
+    at-right?:bool <- equal save-column, right
+    overflow?:bool <- and at-bottom?, at-right?
     break-if overflow?
     move-cursor screen, save-row, save-column
     print screen, c
@@ -239,20 +239,20 @@ def insert-at-cursor editor:address:editor-data, c:character, screen:address:scr
   {
     # not at right margin? print the character and rest of line
     break-unless next
-    at-right?:boolean <- greater-or-equal cursor-column, screen-width
+    at-right?:bool <- greater-or-equal cursor-column, screen-width
     break-if at-right?
-    curr:address:duplex-list:character <- copy before-cursor
+    curr:&:duplex-list:char <- copy before-cursor
     move-cursor screen, save-row, save-column
-    curr-column:number <- copy save-column
+    curr-column:num <- copy save-column
     {
       # hit right margin? give up and let caller render
       go-render? <- copy 1/true
-      at-right?:boolean <- greater-than curr-column, right
+      at-right?:bool <- greater-than curr-column, right
       return-if at-right?
       break-unless curr
       # newline? done.
-      currc:character <- get *curr, value:offset
-      at-newline?:boolean <- equal currc, 10/newline
+      currc:char <- get *curr, value:offset
+      at-newline?:bool <- equal currc, 10/newline
       break-if at-newline?
       print screen, currc
       curr-column <- add curr-column, 1
@@ -267,12 +267,12 @@ def insert-at-cursor editor:address:editor-data, c:character, screen:address:scr
 ]
 
 # helper for tests
-def editor-render screen:address:screen, editor:address:editor-data -> screen:address:screen, editor:address:editor-data [
+def editor-render screen:&:screen, editor:&:editor-data -> screen:&:screen, editor:&:editor-data [
   local-scope
   load-ingredients
-  left:number <- get *editor, left:offset
-  right:number <- get *editor, right:offset
-  row:number, column:number <- render screen, editor
+  left:num <- get *editor, left:offset
+  right:num <- get *editor, right:offset
+  row:num, column:num <- render screen, editor
   clear-line-until screen, right
   row <- add row, 1
   draw-horizontal screen, row, left, right, 9480/horizontal-dotted
@@ -283,11 +283,11 @@ def editor-render screen:address:screen, editor:address:editor-data -> screen:ad
 scenario editor-handles-empty-event-queue [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
+  editor-render screen, 2:&:editor-data
   assume-console []
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -300,16 +300,16 @@ scenario editor-handles-empty-event-queue [
 scenario editor-handles-mouse-clicks [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   assume-console [
     left-click 1, 1  # on the 'b'
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   screen-should-contain [
     .          .
@@ -327,15 +327,15 @@ scenario editor-handles-mouse-clicks [
 scenario editor-handles-mouse-clicks-outside-text [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
   $clear-trace
   assume-console [
     left-click 1, 7  # last line, to the right of text
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   memory-should-contain [
     3 <- 1  # cursor row
@@ -348,15 +348,15 @@ scenario editor-handles-mouse-clicks-outside-text-2 [
   assume-screen 10/width, 5/height
   1:text <- new [abc
 def]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
   $clear-trace
   assume-console [
     left-click 1, 7  # interior line, to the right of text
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   memory-should-contain [
     3 <- 1  # cursor row
@@ -369,15 +369,15 @@ scenario editor-handles-mouse-clicks-outside-text-3 [
   assume-screen 10/width, 5/height
   1:text <- new [abc
 def]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
   $clear-trace
   assume-console [
     left-click 3, 7  # below text
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   memory-should-contain [
     3 <- 2  # cursor row
@@ -390,17 +390,17 @@ scenario editor-handles-mouse-clicks-outside-column [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
   # editor occupies only left half of screen
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   assume-console [
     # click on right half of screen
     left-click 3, 8
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   screen-should-contain [
     .          .
@@ -418,17 +418,17 @@ scenario editor-handles-mouse-clicks-outside-column [
 scenario editor-handles-mouse-clicks-in-menu-area [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   assume-console [
     # click on first, 'menu' row
     left-click 0, 3
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   # no change to cursor
   memory-should-contain [
@@ -440,14 +440,14 @@ scenario editor-handles-mouse-clicks-in-menu-area [
 scenario editor-inserts-characters-into-empty-editor [
   assume-screen 10/width, 5/height
   1:text <- new []
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   assume-console [
     type [abc]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -461,8 +461,8 @@ scenario editor-inserts-characters-into-empty-editor [
 scenario editor-inserts-characters-at-cursor [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   # type two letters at different places
   assume-console [
@@ -471,7 +471,7 @@ scenario editor-inserts-characters-at-cursor [
     type [d]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -485,15 +485,15 @@ scenario editor-inserts-characters-at-cursor [
 scenario editor-inserts-characters-at-cursor-2 [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   assume-console [
     left-click 1, 5  # right of last line
     type [d]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -508,15 +508,15 @@ scenario editor-inserts-characters-at-cursor-5 [
   assume-screen 10/width, 5/height
   1:text <- new [abc
 d]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   assume-console [
     left-click 1, 5  # right of non-last line
     type [e]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -531,15 +531,15 @@ d]
 scenario editor-inserts-characters-at-cursor-3 [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   assume-console [
     left-click 3, 5  # below all text
     type [d]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -554,15 +554,15 @@ scenario editor-inserts-characters-at-cursor-4 [
   assume-screen 10/width, 5/height
   1:text <- new [abc
 d]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   assume-console [
     left-click 3, 5  # below all text
     type [e]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -578,15 +578,15 @@ scenario editor-inserts-characters-at-cursor-6 [
   assume-screen 10/width, 5/height
   1:text <- new [abc
 d]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
+  editor-render screen, 2:&:editor-data
   $clear-trace
   assume-console [
     left-click 3, 5  # below all text
     type [ef]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -601,13 +601,13 @@ d]
 scenario editor-moves-cursor-after-inserting-characters [
   assume-screen 10/width, 5/height
   1:text <- new [ab]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right
+  editor-render screen, 2:&:editor-data
   assume-console [
     type [01]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -622,14 +622,14 @@ scenario editor-moves-cursor-after-inserting-characters [
 scenario editor-wraps-line-on-insert [
   assume-screen 5/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right
+  editor-render screen, 2:&:editor-data
   # type a letter
   assume-console [
     type [e]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   # no wrap yet
   screen-should-contain [
@@ -644,7 +644,7 @@ scenario editor-wraps-line-on-insert [
     type [f]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   # now wrap
   screen-should-contain [
@@ -661,17 +661,17 @@ scenario editor-wraps-line-on-insert-2 [
   assume-screen 10/width, 5/height
   1:text <- new [abcdefg
 defg]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right
-  editor-render screen, 2:address:editor-data
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right
+  editor-render screen, 2:&:editor-data
   # type more text at the start
   assume-console [
     left-click 3, 0
     type [abc]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   # cursor is not wrapped
   memory-should-contain [
@@ -694,26 +694,26 @@ after <insert-character-special-case> [
     # if either:
     # a) we're at the end of the line and at the column of the wrap indicator, or
     # b) we're not at end of line and just before the column of the wrap indicator
-    wrap-column:number <- copy right
-    before-wrap-column:number <- subtract wrap-column, 1
-    at-wrap?:boolean <- greater-or-equal cursor-column, wrap-column
-    just-before-wrap?:boolean <- greater-or-equal cursor-column, before-wrap-column
-    next:address:duplex-list:character <- next before-cursor
+    wrap-column:num <- copy right
+    before-wrap-column:num <- subtract wrap-column, 1
+    at-wrap?:bool <- greater-or-equal cursor-column, wrap-column
+    just-before-wrap?:bool <- greater-or-equal cursor-column, before-wrap-column
+    next:&:duplex-list:char <- next before-cursor
     # at end of line? next == 0 || next.value == 10/newline
-    at-end-of-line?:boolean <- equal next, 0
+    at-end-of-line?:bool <- equal next, 0
     {
       break-if at-end-of-line?
-      next-character:character <- get *next, value:offset
+      next-character:char <- get *next, value:offset
       at-end-of-line? <- equal next-character, 10/newline
     }
     # break unless ((eol? and at-wrap?) or (~eol? and just-before-wrap?))
-    move-cursor-to-next-line?:boolean <- copy 0/false
+    move-cursor-to-next-line?:bool <- copy 0/false
     {
       break-if at-end-of-line?
       move-cursor-to-next-line? <- copy just-before-wrap?
       # if we're moving the cursor because it's in the middle of a wrapping
       # line, adjust it to left-most column
-      potential-new-cursor-column:number <- copy left
+      potential-new-cursor-column:num <- copy left
     }
     {
       break-unless at-end-of-line?
@@ -721,7 +721,7 @@ after <insert-character-special-case> [
       # if we're moving the cursor because it's at the end of a wrapping line,
       # adjust it to one past the left-most column to make room for the
       # newly-inserted wrap-indicator
-      potential-new-cursor-column:number <- add left, 1/make-room-for-wrap-indicator
+      potential-new-cursor-column:num <- add left, 1/make-room-for-wrap-indicator
     }
     break-unless move-cursor-to-next-line?
     cursor-column <- copy potential-new-cursor-column
@@ -730,7 +730,7 @@ after <insert-character-special-case> [
     *editor <- put *editor, cursor-row:offset, cursor-row
     # if we're out of the screen, scroll down
     {
-      below-screen?:boolean <- greater-or-equal cursor-row, screen-height
+      below-screen?:bool <- greater-or-equal cursor-row, screen-height
       break-unless below-screen?
       <scroll-down>
     }
@@ -742,15 +742,15 @@ after <insert-character-special-case> [
 scenario editor-wraps-cursor-after-inserting-characters-in-middle-of-line [
   assume-screen 10/width, 5/height
   1:text <- new [abcde]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right
   assume-console [
     left-click 1, 3  # right before the wrap icon
     type [f]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   screen-should-contain [
     .          .
@@ -771,7 +771,7 @@ scenario editor-wraps-cursor-after-inserting-characters-at-end-of-line [
   # create an editor containing two lines
   contents:text <- new [abc
 xyz]
-  1:address:editor-data/raw <- new-editor contents, screen, 0/left, 5/right
+  1:&:editor-data/raw <- new-editor contents, screen, 0/left, 5/right
   screen-should-contain [
     .          .
     .abc       .
@@ -783,7 +783,7 @@ xyz]
     type [de]  # trigger wrap
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 1:address:editor-data/raw
+    editor-event-loop screen:&:screen, console:&:console, 1:&:editor-data/raw
   ]
   screen-should-contain [
     .          .
@@ -797,15 +797,15 @@ xyz]
 scenario editor-wraps-cursor-to-left-margin [
   assume-screen 10/width, 5/height
   1:text <- new [abcde]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 2/left, 7/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 2/left, 7/right
   assume-console [
     left-click 1, 5  # line is full; no wrap icon yet
     type [01]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   screen-should-contain [
     .          .
@@ -823,7 +823,7 @@ scenario editor-wraps-cursor-to-left-margin [
 # if newline, move cursor to start of next line, and maybe align indent with previous line
 
 container editor-data [
-  indent?:boolean
+  indent?:bool
 ]
 
 after <editor-initialization> [
@@ -833,13 +833,13 @@ after <editor-initialization> [
 scenario editor-moves-cursor-down-after-inserting-newline [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
   assume-console [
     type [0
 1]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -852,7 +852,7 @@ scenario editor-moves-cursor-down-after-inserting-newline [
 
 after <handle-special-character> [
   {
-    newline?:boolean <- equal c, 10/newline
+    newline?:bool <- equal c, 10/newline
     break-unless newline?
     <insert-enter-begin>
     editor <- insert-new-line-and-indent editor, screen
@@ -862,15 +862,15 @@ after <handle-special-character> [
   }
 ]
 
-def insert-new-line-and-indent editor:address:editor-data, screen:address:screen -> editor:address:editor-data, screen:address:screen, go-render?:boolean [
+def insert-new-line-and-indent editor:&:editor-data, screen:&:screen -> editor:&:editor-data, screen:&:screen, go-render?:bool [
   local-scope
   load-ingredients
-  cursor-row:number <- get *editor, cursor-row:offset
-  cursor-column:number <- get *editor, cursor-column:offset
-  before-cursor:address:duplex-list:character <- get *editor, before-cursor:offset
-  left:number <- get *editor, left:offset
-  right:number <- get *editor, right:offset
-  screen-height:number <- screen-height screen
+  cursor-row:num <- get *editor, cursor-row:offset
+  cursor-column:num <- get *editor, cursor-column:offset
+  before-cursor:&:duplex-list:char <- get *editor, before-cursor:offset
+  left:num <- get *editor, left:offset
+  right:num <- get *editor, right:offset
+  screen-height:num <- screen-height screen
   # insert newline
   insert 10/newline, before-cursor
   before-cursor <- next before-cursor
@@ -881,7 +881,7 @@ def insert-new-line-and-indent editor:address:editor-data, screen:address:screen
   *editor <- put *editor, cursor-column:offset, cursor-column
   # maybe scroll
   {
-    below-screen?:boolean <- greater-or-equal cursor-row, screen-height  # must be equal, never greater
+    below-screen?:bool <- greater-or-equal cursor-row, screen-height  # must be equal, never greater
     break-unless below-screen?
     <scroll-down>
     go-render? <- copy 1/true
@@ -889,16 +889,16 @@ def insert-new-line-and-indent editor:address:editor-data, screen:address:screen
     *editor <- put *editor, cursor-row:offset, cursor-row
   }
   # indent if necessary
-  indent?:boolean <- get *editor, indent?:offset
+  indent?:bool <- get *editor, indent?:offset
   return-unless indent?
-  d:address:duplex-list:character <- get *editor, data:offset
-  end-of-previous-line:address:duplex-list:character <- prev before-cursor
-  indent:number <- line-indent end-of-previous-line, d
-  i:number <- copy 0
+  d:&:duplex-list:char <- get *editor, data:offset
+  end-of-previous-line:&:duplex-list:char <- prev before-cursor
+  indent:num <- line-indent end-of-previous-line, d
+  i:num <- copy 0
   {
-    indent-done?:boolean <- greater-or-equal i, indent
+    indent-done?:bool <- greater-or-equal i, indent
     break-if indent-done?
-    editor, screen, go-render?:boolean <- insert-at-cursor editor, 32/space, screen
+    editor, screen, go-render?:bool <- insert-at-cursor editor, 32/space, screen
     i <- add i, 1
     loop
   }
@@ -906,23 +906,23 @@ def insert-new-line-and-indent editor:address:editor-data, screen:address:screen
 
 # takes a pointer 'curr' into the doubly-linked list and its sentinel, counts
 # the number of spaces at the start of the line containing 'curr'.
-def line-indent curr:address:duplex-list:character, start:address:duplex-list:character -> result:number [
+def line-indent curr:&:duplex-list:char, start:&:duplex-list:char -> result:num [
   local-scope
   load-ingredients
-  result:number <- copy 0
+  result:num <- copy 0
   return-unless curr
-  at-start?:boolean <- equal curr, start
+  at-start?:bool <- equal curr, start
   return-if at-start?
   {
     curr <- prev curr
     break-unless curr
-    at-start?:boolean <- equal curr, start
+    at-start?:bool <- equal curr, start
     break-if at-start?
-    c:character <- get *curr, value:offset
-    at-newline?:boolean <- equal c, 10/newline
+    c:char <- get *curr, value:offset
+    at-newline?:bool <- equal c, 10/newline
     break-if at-newline?
     # if c is a space, increment result
-    is-space?:boolean <- equal c, 32/space
+    is-space?:bool <- equal c, 32/space
     {
       break-unless is-space?
       result <- add result, 1
@@ -939,13 +939,13 @@ def line-indent curr:address:duplex-list:character, start:address:duplex-list:ch
 scenario editor-moves-cursor-down-after-inserting-newline-2 [
   assume-screen 10/width, 5/height
   1:text <- new [abc]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 1/left, 10/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 1/left, 10/right
   assume-console [
     type [0
 1]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   screen-should-contain [
     .          .
@@ -959,7 +959,7 @@ scenario editor-moves-cursor-down-after-inserting-newline-2 [
 scenario editor-clears-previous-line-completely-after-inserting-newline [
   assume-screen 10/width, 5/height
   1:text <- new [abcde]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 5/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right
   assume-console [
     press enter
   ]
@@ -971,7 +971,7 @@ scenario editor-clears-previous-line-completely-after-inserting-newline [
     .          .
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
   ]
   # line should be fully cleared
   screen-should-contain [
@@ -988,7 +988,7 @@ scenario editor-inserts-indent-after-newline [
   1:text <- new [ab
   cd
 ef]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
   # position cursor after 'cd' and hit 'newline'
   assume-console [
     left-click 2, 8
@@ -996,9 +996,9 @@ ef]
 ]
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   # cursor should be below start of previous line
   memory-should-contain [
@@ -1012,7 +1012,7 @@ scenario editor-skips-indent-around-paste [
   1:text <- new [ab
   cd
 ef]
-  2:address:editor-data <- new-editor 1:text, screen:address:screen, 0/left, 10/right
+  2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 10/right
   # position cursor after 'cd' and hit 'newline' surrounded by paste markers
   assume-console [
     left-click 2, 8
@@ -1021,9 +1021,9 @@ ef]
     press 65506  # end paste
   ]
   run [
-    editor-event-loop screen:address:screen, console:address:console, 2:address:editor-data
-    3:number <- get *2:address:editor-data, cursor-row:offset
-    4:number <- get *2:address:editor-data, cursor-column:offset
+    editor-event-loop screen:&:screen, console:&:console, 2:&:editor-data
+    3:num <- get *2:&:editor-data, cursor-row:offset
+    4:num <- get *2:&:editor-data, cursor-column:offset
   ]
   # cursor should be below start of previous line
   memory-should-contain [
@@ -1034,7 +1034,7 @@ ef]
 
 after <handle-special-key> [
   {
-    paste-start?:boolean <- equal k, 65507/paste-start
+    paste-start?:bool <- equal k, 65507/paste-start
     break-unless paste-start?
     *editor <- put *editor, indent?:offset, 0/false
     go-render? <- copy 1/true
@@ -1044,7 +1044,7 @@ after <handle-special-key> [
 
 after <handle-special-key> [
   {
-    paste-end?:boolean <- equal k, 65506/paste-end
+    paste-end?:bool <- equal k, 65506/paste-end
     break-unless paste-end?
     *editor <- put *editor, indent?:offset, 1/true
     go-render? <- copy 1/true
@@ -1054,28 +1054,28 @@ after <handle-special-key> [
 
 ## helpers
 
-def draw-horizontal screen:address:screen, row:number, x:number, right:number -> screen:address:screen [
+def draw-horizontal screen:&:screen, row:num, x:num, right:num -> screen:&:screen [
   local-scope
   load-ingredients
-  style:character, style-found?:boolean <- next-ingredient
+  style:char, style-found?:bool <- next-ingredient
   {
     break-if style-found?
     style <- copy 9472/horizontal
   }
-  color:number, color-found?:boolean <- next-ingredient
+  color:num, color-found?:bool <- next-ingredient
   {
     # default color to white
     break-if color-found?
     color <- copy 245/grey
   }
-  bg-color:number, bg-color-found?:boolean <- next-ingredient
+  bg-color:num, bg-color-found?:bool <- next-ingredient
   {
     break-if bg-color-found?
     bg-color <- copy 0/black
   }
   screen <- move-cursor screen, row, x
   {
-    continue?:boolean <- lesser-or-equal x, right  # right is inclusive, to match editor-data semantics
+    continue?:bool <- lesser-or-equal x, right  # right is inclusive, to match editor-data semantics
     break-unless continue?
     print screen, style, color, bg-color
     x <- add x, 1