about summary refs log tree commit diff stats
path: root/061text.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-09-11 17:14:48 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-09-11 17:50:36 -0700
commitcdf0f349d1ad432d785cf69c7a136fff07258adf (patch)
treefe88b7b2039e9d50ce5b37cc115315a12f22d797 /061text.mu
parent68578a7828ce8300fa10b28b5f57e56723303e93 (diff)
downloadmu-cdf0f349d1ad432d785cf69c7a136fff07258adf.tar.gz
3324 - completely redo type abbreviations
The old approach with '&' and '@' modifiers turned out to be a bad idea
because it introduces notions of precedence. Worse, it turns out you
want different precedence rules at different times as the old test
alluded:

  x:@number:3  # we want this to mean (address number 3)
  x:address:@number  # we want this to mean (address array number)

Instead we'll give up and focus on a single extensible mechanism that
allows us to say this instead:

  x:@:number:3
  x:address:@:number

In addition it allows us to shorten other types as well:

  x:&:@:num

  type board = &:@:&:@:char  # for tic-tac-toe

Hmm, that last example reminds me that we don't handle abbreviations
inside type abbreviation definitions so far..
Diffstat (limited to '061text.mu')
-rw-r--r--061text.mu1
1 files changed, 1 insertions, 0 deletions
diff --git a/061text.mu b/061text.mu
index 6d0fb082..4ef96629 100644
--- a/061text.mu
+++ b/061text.mu
@@ -1,4 +1,5 @@
 # Some useful helpers for dealing with text (arrays of characters)
+type text = address:array:character
 
 # to-text-line gets called implicitly in various places
 # define it to be identical to 'to-text' by default