Nested value types
Date: Mon, 14 Jul 2008 03:02:45 -0700 (PDT)
Message-ID: <320065ef-0bf7-42ee-af6e-997b53939fed_at_k13g2000hse.googlegroups.com>
In the following I’m using the definitions of value, variable and type described by C.Date. Values are eternal and immutable. Variables are holders for values that exist in some context. Values and variables are both typed.
Let a “pointer” be any reference to a variable in some context.
Let x be called a subvariable of y if x encodes part of the value encoded by y. Note therefore that changing x causes y to change as well.
Consider the following type definition for a 2D point:
tuple Point
{
float x,y;
};
A Point value is composed from nested values. Variables don’t enter into the picture.
A Point variable has subvariables for the x and y coordinates.
This can be used to help define a circle type:
tuple Circle1
{
Point centre;
float radius;
};
Some people on this NG have suggested that tuples should take a back seat role and in the type system all one needs are relations. But consider:
relation Circle2
{
Point centre;
float radius;
};
This seems wrong because circle values are not propositions.
Now consider:
relation Circle3
{
string name;
Point centre;
float radius;
};
The interesting thing is that a value of type Chapter is able to represent any tree structure in the form of pure nested values, without anything that looks remotely like a pointer to a variable. Nevertheless I would call the structure dynamic not static because it isn’t fixed by the static type.