Re: no names allowed, we serve types only

From: Keith H Duggar <duggar_at_alum.mit.edu>
Date: Sun, 14 Feb 2010 22:14:03 -0800 (PST)
Message-ID: <29d1b250-f284-47cd-a655-efefb540907c_at_z26g2000yqm.googlegroups.com>


On Feb 14, 5:22 pm, Nilone <rea..._at_gmail.com> wrote:
> On Feb 13, 10:53 pm, Keith H Duggar <dug..._at_alum.mit.edu> wrote:
>
> > I'm wondering, do we really need A? Can we not simplify this
> > header notion to just a set of types? All we need do then is
> > supply operators to conveniently "copy" types if or when one
> > needs multiples attributes of the "same" type.
>
> I'm happy to see some activity in here again.

Indeed. Thanks for joining ;-)

> Your suggestion could help to force developers to derive uniquely
> named types for their attributes - Name instead of String, Age instead
> of Int, and so on. Otherwise, type names aren't descriptive enough
> and will result in the annotation of schemata with comments, with all
> the associated problems. It'll happen anyway, of course - if
> something is optional, people will skip it.

Agreed. This is one way to "encourage" more sensible typing. Of course it requires good type support which many current vendors certainly do not provide.

> I also see some problems with type checking. Consider the query
> "SELECT * FROM Point2D WHERE X = Y". Comparison of the attributes
> require that they be the same type (or at least, one should be a
> subtype of the other). Distinguishing unnamed attributes require that
> they be unique types, which is the reason for copying them, but that
> contradicts the comparison requirement.

As copies of Integer, both X and Y can be coerced to Integer. So we can allow either implicit or explicit type coercion. So either we can allow

   WHERE X = Y by default or require explicit coercion

   WHERE Integer(X) = Integer(Y)

by default. And which is allowed or required should again be left to the type system. So when I declare

   copy Integer X

it may by default add both explicit and implicit coercion operators

   () : X -> Integer
   () : X -> Integer
   Integer() : X -> Integer
   Integer() : X -> Integer

or perhaps the following equality operators

  • : Integer , X -> bool
  • : X , Integer -> bool

which would allow the simple WHERE X = Y but one should be able to disable that for example by "deleting" those operators

   delete () : X -> Integer
   delete () : X -> Integer

or

   delete = : Integer , X -> bool
   delete = : X , Integer -> bool

In which case WHERE X = Y is now illegal and one must write the coercions explicitly such as WHERE Integer(X) = Integer(Y).

KHD Received on Mon Feb 15 2010 - 07:14:03 CET

Original text of this message