Re: Translating constraints to RM Terms
Date: Mon, 06 Jun 2005 13:09:18 +0200
Message-ID: <mlb8a1ps7in8stb0v0vnb1uvdop3ssia2n_at_4ax.com>
On Mon, 06 Jun 2005 11:41:32 +0100, Paul <paul_at_test.com> wrote:
>Here's an example to think about: I create a domain/type called "Number"
>which contains real numbers (maybe chopped off at some min/max values
>and some level of decimal places or significant figures). I make a
>column with this as the type. Then I add a column constraint like
>"round(col) = col" i.e. the value must be an integer.
>
>Is this functionally identical to creating an "integer" type and using that?
No, you would not have integer division, for instance.
>To go further, imagine a universal type that was a union of the set of
>every possible type you could want. You set every column to this type
>and then have column constraints to restrict each column to the values
>you want.
Then you would not have any operation other than equality. You would have to "cast" the values all the time.
In Tutorial D there is a type that is the set of all scalar values: Alpha
We can do things like this:
var a relation { a Alpha };
a := relation { tuple { a 1 }, tuple { a 'shoe' } };
Although this does not work with Rel AFAIK.
>Maybe this would link in with the thread on NULLs in that your universal
>type would only need a single universal NULL?
Nulls are not values, they are an ad hoc cheat.
>Note: I'm not seriously advocating this, just arguing a logical point to
>see if it reaches an absurdity.
Good attitude.
Regards Received on Mon Jun 06 2005 - 13:09:18 CEST