2009-12-27

datatype syntax

8.30: adda/syntax/types:

. isn't typing for struct and type similar?
literals are
rect: a.(a, b, c), -- use as a`a,
type: a.{op1, op2} -- use as ?
. rect is like array not type?
. need to be orthogonal about naming and typing;
eg, worry about this: a#(dom).rng
. what if need to type array or function?
with current syntax it can't be but part of the name .
. array.type = #(dom).rng ?
. biop.type = (t,t)-> t .

. 1st class typing is confusion?
. you must first see what all types are in terms of adt
eg,
array, rec, vector are lists,
rec is list of object named by set
array is list of object named by scalar
vector is list of obj named by scalar
.
function is set of object named by set
enum is set of ordered symbol of type integer

. then type def according to that system
. for syntax that is more consistent than convenient:
eg, may need to use names in typedefs such as rec, enum, array, etc,
rather than id these types implicit by struct .

. the fundamental of every type is
(
head:
set of symbols used as literals
set of symbols for operations on literals
body:
how literals are coded ,
how operations are implemented .
)
another dimension:
. struct typing can be either by having types match
or also names match,
like param assignment vs record assignment .
ie,
ordered list of symbols
vs ordered list of values (literals)
vs ordered list of objects (literal encodings) .