Hi,
*** This email is primarily for Josh (and Kuppitz).
I think we need Josh's type system core to mm-ADT. I’m facing the problem of
having to model both a “range” (legal schema) and a “codomain” (current schema)
of the referents of a reference. Let me explain with an example.
Suppose that there is an SQL table called ‘people’ and the table is empty. When
I mm-ADT serves up a this table, it looks like this in mm-ADT:
[db][get,’people’] // *{name:@string, age:@int}
This says that ‘people’ is a pointer to maps containing a name-key with a
string value and an age-key with an integer value.
Now lets say I insert some rows into this table. Now, according to the mm-ADT
spec, every reference must have as much information as possible about the
referents. Thus, the people-reference pattern can change. Lets assume it does
and it now is:
[db][get,’people’] // *{name:@string, age:!gt(20)&!lt(33)}
We have lost information about the “schema.” This is not good as compile-time
write validation is not possible.
Thus, I want to make a distinction between “range” and “codomain”. Here is some
bytecode:
[db][define,’person’,{name:@string,age:@int}]
[db][create,’people’,*person]
I define a type called person, where all such instances must match the
respective map-pattern.
I then create a people-key on the db map that maintains a person-reference.
Now:
[db][add,’people’,{name:marko,age:29}]
[db][add,’people’,{name:josh,age:32}]
...
[db][get,’people'] // *person{name:@string, age:!gt(20)&!lt(33)}
[db][type,’person'] // {name:@string, age:@int}
Thus, when I get the reference at people, I see the “codomain” of current
person referents, but when I get the person-type, I get the “range” of legal
person referents.
In this way, “types” become central to mm-ADT, where schema is crucial in
specifying a referent range.
—I have more to say on the necessity of multi-types (union of types) and their
role in pattern definitions.
Thoughts?,
Marko.
http://rredux.com <http://rredux.com/>