![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Of course the conventional definition of a relation's header is a set of ordered pairs of "attributes" of the form <A, T> where A is the "name" of the attribute (which must be unique within the header) and T is a type. |
|
I'm wondering, do we really need A? Can we not simplify this header notion to just a set of types? |
|
So aren't the "ordered pair" and "attribute names" a perhaps sometimes convenient yet always unnecessary complication? We can do all we need to solely with types and sufficiently rich type systems. |
#2
| ||||||
| ||||||
|
|
Keith H Duggar <dug... (AT) alum (DOT) mit.edu> writes: Of course the conventional definition of a relation's header is a set of ordered pairs of "attributes" of the form <A, T> where A is the "name" of the attribute (which must be unique within the header) and T is a type. The use of set of ordered pairs is telling. Note that the *pairs* are ordered, while the *set* is not; the attributes are unordered within the header. |
|
I'm wondering, do we really need A? Can we not simplify this header notion to just a set of types? The point of a unique name is to be able to address the attribute. |
|
Without it, there would be no way to distinguish between attributes of identical types in the header. |
|
There would also be no way to change the type of an attribute without also changing all the references to that attribute, even ones where the type is irrelevant. |
|
So aren't the "ordered pair" and "attribute names" a perhaps sometimes convenient yet always unnecessary complication? |
|
So aren't the "ordered pair" and "attribute names" a perhaps sometimes convenient yet always unnecessary complication? We can do all we need to solely with types and sufficiently rich type systems. You think we don't need to uniquely address attributes within a header? |
#3
| |||
| |||
|
|
You think my proposal does not allow you to uniquely address header attributes? I think you need to try again, perhaps with less of a focus on "telling us" what sets and ordered pairs are. |
|
KHD |
#4
| |||
| |||
|
|
On Feb 14, 12:41 am, Ben Finney <bignose+hates-s... (AT) benfinney (DOT) id.au wrote: Keith H Duggar <dug... (AT) alum (DOT) mit.edu> writes: I'm wondering, do we really need A? Can we not simplify this header notion to just a set of types? The point of a unique name is to be able to address the attribute. Without it, there would be no way to distinguish between attributes of identical types in the header. Which is why I said you could "copy" identical types to yield unique but related types. |
#5
| |||
| |||
|
|
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. |
#6
| |||
| |||
|
|
On Feb 13, 10:53 pm, Keith H Duggar <dug... (AT) alum (DOT) 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. |
|
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. |
|
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. |
#7
| |||
| |||
|
|
() : X -> Integer () : X -> Integer Integer() : X -> Integer Integer() : X -> Integer .... delete () : X -> Integer delete () : X -> Integer |
|
() : X -> Integer () : Y -> Integer Integer() : X -> Integer Integer() : Y -> Integer .... delete () : X -> Integer delete () : Y -> Integer |
#8
| |||
| |||
|
|
Keith H Duggar wrote: You think my proposal does not allow you to uniquely address header attributes? I think you need to try again, perhaps with less of a focus on "telling us" what sets and ordered pairs are. Perhaps it would help if you explain what a 'copied type' is |
|
and how 'copying types' is more convenient than ordering or naming different attributes with the same type. |
#9
| |||
| |||
|
|
Keith H Duggar <dug... (AT) alum (DOT) mit.edu> writes: On Feb 14, 12:41 am, Ben Finney <bignose+hates-s... (AT) benfinney (DOT) id.au wrote: Keith H Duggar <dug... (AT) alum (DOT) mit.edu> writes: I'm wondering, do we really need A? Can we not simplify this header notion to just a set of types? The point of a unique name is to be able to address the attribute. Without it, there would be no way to distinguish between attributes of identical types in the header. Which is why I said you could "copy" identical types to yield unique but related types. You didn't say that, but thanks for the explanation. Okay, so the copy type operation yields a type that is identical to the original except for its name. What problem is being solved by this? |
#10
| |||
| |||
|
|
On Feb 14, 4:45 pm, Ben Finney <bignose+hates-s... (AT) benfinney (DOT) id.au wrote: Okay, so the “copy type” operation yields a type that is identical to the original except for its name. What problem is being solved by this? It is an alternate solution to the problem of identifying attributes that we want to have the "same type". One solution is to introduce "attribute names". Another, the one I'm proposing here, is to enrich the type system to provide these "type copies" which are distinct but mutually coercible types. I believe this solution is simpler in some ways and that often one is already in possession of all unique types in which case attribute names just "get in the way" to some extent. |
![]() |
| Thread Tools | |
| Display Modes | |
| |