about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-12-17 10:39:58 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-12-17 10:39:58 -0800
commit4725111d23e5e19e903d87a8447080229b0b9f35 (patch)
tree503d00258b98c25ec2789f766025ec8645e391db
parentfaad417b119394dc80eabadeab29c4128094230e (diff)
downloadmu-4725111d23e5e19e903d87a8447080229b0b9f35.tar.gz
431 - rename 'record' (struct) to 'and-record'
Now we can call unions 'or-record'.
-rw-r--r--mu.arc22
-rw-r--r--mu.arc.t28
2 files changed, 25 insertions, 25 deletions
diff --git a/mu.arc b/mu.arc
index d2146938..66478329 100644
--- a/mu.arc
+++ b/mu.arc
@@ -108,27 +108,27 @@
               integer-array-address-address (obj size 1  address t  elem 'integer-array-address)
               integer-address (obj size 1  address t  elem 'integer)  ; pointer to int
               integer-address-address (obj size 1  address t  elem 'integer-address)
-              ; records consist of a series of elems, corresponding to a list of types
-              integer-boolean-pair (obj size 2  record t  elems '(integer boolean)  fields '(int bool))
+              ; and-records consist of a series of elems, corresponding to a list of types
+              integer-boolean-pair (obj size 2  and-record t  elems '(integer boolean)  fields '(int bool))
               integer-boolean-pair-address (obj size 1  address t  elem 'integer-boolean-pair)
               integer-boolean-pair-array (obj array t  elem 'integer-boolean-pair)
               integer-boolean-pair-array-address (obj size 1  address t  elem 'integer-boolean-pair-array)
-              integer-integer-pair (obj size 2  record t  elems '(integer integer))
-              integer-point-pair (obj size 2  record t  elems '(integer integer-integer-pair))
+              integer-integer-pair (obj size 2  and-record t  elems '(integer integer))
+              integer-point-pair (obj size 2  and-record t  elems '(integer integer-integer-pair))
               integer-point-pair-address (obj size 1  address t  elem 'integer-point-pair)
               integer-point-pair-address-address (obj size 1  address t  elem 'integer-point-pair-address)
               ; tagged-values are the foundation of dynamic types
-              tagged-value (obj size 2  record t  elems '(type location)  fields '(type payload))
+              tagged-value (obj size 2  and-record t  elems '(type location)  fields '(type payload))
               tagged-value-address (obj size 1  address t  elem 'tagged-value)
               tagged-value-array (obj array t  elem 'tagged-value)
               tagged-value-array-address (obj size 1  address t  elem 'tagged-value-array)
               tagged-value-array-address-address (obj size 1  address t  elem 'tagged-value-array-address)
               ; heterogeneous lists
-              list (obj size 2  record t  elems '(tagged-value list-address)  fields '(car cdr))
+              list (obj size 2  and-record t  elems '(tagged-value list-address)  fields '(car cdr))
               list-address (obj size 1  address t  elem 'list)
               list-address-address (obj size 1  address t  elem 'list-address)
               ; parallel routines use channels to synchronize
-              channel (obj size 3  record t  elems '(integer integer tagged-value-array-address)  fields '(first-full first-free circular-buffer))
+              channel (obj size 3  and-record t  elems '(integer integer tagged-value-array-address)  fields '(first-full first-free circular-buffer))
               channel-address (obj size 1  address t  elem 'channel)
               ; editor
               line (obj array t  elem 'character)
@@ -400,7 +400,7 @@
                       (trace "jump" "jumping to " pc.routine*)
                       (continue)))
 
-                ; data management: scalars, arrays, records
+                ; data management: scalars, arrays, and-records (structs)
                 copy
                   (m arg.0)
                 get
@@ -683,9 +683,9 @@
                 :else  ; naked type
                   x)
     (assert types*.type "sizeof: no such type @type")
-    (if (~or types*.type!record types*.type!array)
+    (if (~or types*.type!and-record types*.type!array)
           types*.type!size
-        types*.type!record
+        types*.type!and-record
           (sum idfn
             (accum yield
               (each elem types*.type!elems
@@ -887,7 +887,7 @@
               ; todo: need to rename args.0 as well?
               (when (pos '(deref) (metadata args.0))
                 (trace "cn0" "field-access deref")
-                (assert basetype!address "@args.0 requests deref, but it's not an address of a record")
+                (assert basetype!address "@args.0 requests deref, but it's not an address")
                 (= basetype (types* basetype!elem)))
               (when (isa field 'sym)
                 (assert (or (~location field) isa-field.field) "field @args.1 is also a variable")
diff --git a/mu.arc.t b/mu.arc.t
index 59ba0e78..18de91a8 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -470,9 +470,9 @@
 ;
 ; Until now we've dealt with scalar types like integers and booleans and
 ; addresses, where mu looks like other assembly languages. In addition, mu
-; provides first-class support for compound types: arrays and records.
+; provides first-class support for compound types: arrays and and-records.
 ;
-; 'get' accesses fields in records
+; 'get' accesses fields in and-records
 ; 'index' accesses indices in arrays
 ;
 ; Both operations require knowledge about the types being worked on, so all
@@ -483,7 +483,7 @@
 ; first a sanity check that the table of types is consistent
 (reset)
 (each (typ typeinfo) types*
-  (when typeinfo!record
+  (when typeinfo!and-record
     (assert (is typeinfo!size (len typeinfo!elems)))
     (when typeinfo!fields
       (assert (is typeinfo!size (len typeinfo!fields))))))
@@ -501,7 +501,7 @@
 (run 'main)
 ;? (prn memory*)
 (if (~iso memory* (obj 1 34  2 nil  3 nil  4 34))
-  (prn "F - 'get' accesses fields of records"))
+  (prn "F - 'get' accesses fields of and-records"))
 ;? (quit)
 
 (reset)
@@ -518,7 +518,7 @@
 (run 'main)
 ;? (prn memory*)
 (if (~iso memory* (obj 1 34  2 nil  3 1  4 nil  5 34))
-  (prn "F - 'get' accesses fields of record address"))
+  (prn "F - 'get' accesses fields of and-record address"))
 
 (reset)
 (new-trace "get-indirect-repeated")
@@ -562,7 +562,7 @@
 (run 'main)
 ;? (prn memory*)
 (if (~iso memory* (obj 1 34  2 t  3 2))
-  (prn "F - 'get-address' returns address of fields of records"))
+  (prn "F - 'get-address' returns address of fields of and-records"))
 
 (reset)
 (new-trace "get-address-indirect")
@@ -576,7 +576,7 @@
 (run 'main)
 ;? (prn memory*)
 (if (~iso memory* (obj 1 34  2 t  3 1  4 2))
-  (prn "F - 'get-address' accesses fields of record address"))
+  (prn "F - 'get-address' accesses fields of and-record address"))
 
 (reset)
 (new-trace "index-literal")
@@ -857,8 +857,8 @@
   (prn "F - 'new-tagged-value' is the converse of 'maybe-coerce'"))
 ;? (quit)
 
-; Now that we can record types for values we can construct a dynamically typed
-; list.
+; Now that we can package values together with their types, we can construct a
+; dynamically typed list.
 
 (reset)
 (new-trace "list")
@@ -3465,9 +3465,9 @@
 (if (~is 1 sizeof!integer-address)
   (prn "F - 'sizeof' works on addresses"))
 (if (~is 2 sizeof!integer-boolean-pair)
-  (prn "F - 'sizeof' works on records"))
+  (prn "F - 'sizeof' works on and-records"))
 (if (~is 3 sizeof!integer-point-pair)
-  (prn "F - 'sizeof' works on records with record fields"))
+  (prn "F - 'sizeof' works on and-records with and-record fields"))
 
 ;? (prn 410)
 (if (~is 1 (sizeof '((34 integer))))
@@ -3475,11 +3475,11 @@
 (if (~is 1 (sizeof '((34 integer-address))))
   (prn "F - 'sizeof' works on address operands"))
 (if (~is 2 (sizeof '((34 integer-boolean-pair))))
-  (prn "F - 'sizeof' works on record operands"))
+  (prn "F - 'sizeof' works on and-record operands"))
 (if (~is 3 (sizeof '((34 integer-point-pair))))
-  (prn "F - 'sizeof' works on record operands with record fields"))
+  (prn "F - 'sizeof' works on and-record operands with and-record fields"))
 (if (~is 2 (sizeof '((34 integer-boolean-pair-address) (deref))))
-  (prn "F - 'sizeof' works on pointers to records"))
+  (prn "F - 'sizeof' works on pointers to and-records"))
 (= memory*.35 4)  ; size of array
 (= memory*.34 35)
 ;? (= dump-trace* (obj whitelist '("sizeof" "array-len")))