![]() | |
#11
| ||||
| ||||
|
|
On May 29, 8:12 am, Erwin <e.sm... (AT) myonline (DOT) be> wrote: Haven't gone through the other responses first, perhaps I should have, but anyway here goes (see inlined answers) : On 26 mei, 06:04, David BL <davi... (AT) iinet (DOT) net.au> wrote: 3) Is it correct that a POSSREP typically doesn't unambiguously define a method for encoding values of type T on some physical medium? The POSSREPs as defined in the TTM literature have nothing to do with physical encoding. 4) Consider a POINT value is encoded in computer memory using a '\0' terminated ASCII string such as "(1.34,-6.2)", and must be parsed according to some well defined grammar in order to retrieve the x,y coordinates. Does this qualify as a CARTESIAN representation? It could qualify as a valid POSSREP for the POINT type, but it is a different one from the CARTESIAN possrep typically used in Date&Darwen's relational writings. What do you mean it could qualify as a valid POSSREP for POINT when you just stated POSSREPS have nothing to do with physical encoding? |
|
5) Is it correct to say that in Tutorial D types are sometimes defined in terms of possreps? Yes. *In fact this holds for all of them, except then the "basic" ones such as INTEGER, BOOLEAN, ... Would you say union types are defined in terms of POSSREPS? |
|
13) Is it appropriate for assumptions about types employed in POSSREP declarations to be visible in the signatures of the operators at the logical level of discourse? *For example, that the return type of THE_X is RATIONAL: * * OPERATOR THE_X ( P POINT ) RETURNS RATIONAL; Don't see a problem. *This operator coming into existence is a direct consequence of the fact that POINT is declared to have an X component of type RATIONAL in one of its declared possreps. So it's a direct consequence of the type definition, which is itself also at the logical level of discourse, no ? I agree there is no problem assuming a POSSREP is at the logical level of discourse. *However, I would use REAL not RATIONAL. |
|
17) Why are only some operators called "selectors"? *I would have thought this distinction only arises from physical implementation concerns. *Is it not true that at an abstract level any operator that returns values of type T can be regarded as a means of selecting values of type T? You're right. *The term was probably introduced to be able to speak of "operators" in general, instead of having to continuously say "operators and/or literals". *Just like OO texts might want to talk of "methods" in general, rather than "methods and/or constructors". (Note that literals and selectors are not the same thing. *All literals are selectors, but not all value selectors are literals. Literals are value selectors with no arguments, while there might be other value selectors that do take arguments. *But the term "value selector" is restricted to those cases where the arguments match the POSSREP declaration : VAR RATIONAL X,Y; VAR POINT P = CARTESIAN(X,Y); */* this is a value selector but not a literal */ P = SHIFTHORZ(P, 2); */* allthough SHIFTHORZ returns a POINT value, and must thus itself _contain_ a POINT value selector, SHITHORZ itself is not a "value selector" */ I would define a literal to be any expression (of nested operator invocations) containing no variables. |
#12
| ||||
| ||||
|
|
On 30 mei, 05:04, David BL <davi... (AT) iinet (DOT) net.au> wrote: On May 29, 8:12 am, Erwin <e.sm... (AT) myonline (DOT) be> wrote: Haven't gone through the other responses first, perhaps I should have, but anyway here goes (see inlined answers) : On 26 mei, 06:04, David BL <davi... (AT) iinet (DOT) net.au> wrote: 3) Is it correct that a POSSREP typically doesn't unambiguously define a method for encoding values of type T on some physical medium? The POSSREPs as defined in the TTM literature have nothing to do with physical encoding. 4) Consider a POINT value is encoded in computer memory using a '\0' terminated ASCII string such as "(1.34,-6.2)", and must be parsed according to some well defined grammar in order to retrieve the x,y coordinates. Does this qualify as a CARTESIAN representation? It could qualify as a valid POSSREP for the POINT type, but it is a different one from the CARTESIAN possrep typically used in Date&Darwen's relational writings. What do you mean it could qualify as a valid POSSREP for POINT when you just stated POSSREPS have nothing to do with physical encoding? Sorry. Missed the "suppose ... is encoded in memory as a nul- terminated string". I meant to say that there is nothing in the concept you describe that would make it an "invalid" (logical) possrep. In fact, ALL types can "conceptually" be regarded as having a "STRING" possrep, which produces the "externalization" of any value of the type. More or less equivalent to Java's toString() method that exists for all objects. |
|
However, in its role as a "physical possrep", there is more to it than what you say. It is not sufficient to say "encoded as a nul- terminated string" to determine the actual bit pattern for a value. Because the encoding of the string itself is also relevant, and a possible source of differences. UTF-8 gives different bit patterns compared to UTF-16. Byte ordering conventions produce different bit patterns for any kind of integer numbers (except the single-byte ones of course). etc. etc. Switching the order of the X and Y components in an encoding that is based on the (two-component) CARTESIAN possrep, will produce different bit patterns too. |
|
That was my point where I said "targeted to the machine" : specifying a physical possrep requires the specification of _every single detail_ that plays a role in determining the ultimate bit pattern. So for this reason, your CARTESIAN possrep does not qualify as a valid physical possrep, because it is incomplete. |
|
5) Is it correct to say that in Tutorial D types are sometimes defined in terms of possreps? Yes. In fact this holds for all of them, except then the "basic" ones such as INTEGER, BOOLEAN, ... Would you say union types are defined in terms of POSSREPS? Oops. You're probably right. I wasn't thinking of those. UNION types typically even will not have a POSSREP of their own (allthough it is always possible to conceive a toString()-like POSSREP which includes both "actual" typename and externalization-of-value. But beware that in the Manifesto, declaring a UNION type is _not_ merely a matter of saying : TYPE PLANE_FIGURE IS ELLIPSE UNION POLYGON; /* where ELLIPSE and POLYGON were formerly root types */ Strictly speaking, the Manifesto requires that "simultaneously", the declaration of the existing root types is changed to TYPE ELLIPSE IS PLANE_FIGURE ... , TYPE POLYGON IS PLANE_FIGURE ... ; /* note the comma, as opposed to a semicolon */ |
#13
| ||||||
| ||||||
|
|
I'm not sure what you are saying there. |
|
Types and hence values and operators are pure mathematical abstractions. Nested operator invocations provide an entirely sufficient means for (logically) representing values. |
|
I find it superfluous to introduce POSSREPs for this purpose (as though operators are inadequate!), as well as all the other confusing and redundant vernacular: "atomic", "encapsulated", "scalar", "structure", "selector", "dummy type" etc. In fact I'm now thinking of POSSREPS as merely a peculiar syntactic sugar for declaring operators. |
|
Operators being pure abstractions must be distinguished from any implementation as executable routines on computers. In fact operators are the basis for data representation and not just the basis for defining calculations to be executed. It seems as though this former perspective was missed when the redundant idea of POSSREPS was introduced, and yet strangely was made apparent when each POSSREP implicitly declared a kind of operator called a selector. |
|
Let STRING be a type. POINT and STRING are distinct types. I see no need to complicate things by trying to formalise some notion of a "possible representation" of POINT involving STRING. *All that's required are /explicit/ unary operators that map POINT to STRING and vice versa. |
|
It seems awkward to need to specify one subtype relationship in two places. |
#14
| ||||||
| ||||||
|
|
On 31 mei, 09:26, David BL <davi... (AT) iinet (DOT) net.au> wrote: I'm not sure what you are saying there. You gave an example of a representation where values of type POINT are denoted in some kind of textual way. I merely said there is nothing to this construct that would somehow render it "unacceptable" as a (logical) possrep. |
|
Types and hence values and operators are pure mathematical abstractions. Nested operator invocations provide an entirely sufficient means for (logically) representing values. ??????? Not following you at all. Operators are themselves functions thus relations, thus values !!! RELATION PLUS {{1,1,2} {1,2,3} {2,1,3} ...} |
|
In what way do you see a "nested operator invocation" being able to, or being needed to, represent the value "INTEGER 1" ? |
|
I find it superfluous to introduce POSSREPs for this purpose (as though operators are inadequate!), as well as all the other confusing and redundant vernacular: "atomic", "encapsulated", "scalar", "structure", "selector", "dummy type" etc. In fact I'm now thinking of POSSREPS as merely a peculiar syntactic sugar for declaring operators. That might not be so terribly wrong, allthoug I personally think this particular "peculiar syntactic sugar" is quite convenient. |
|
Operators being pure abstractions must be distinguished from any implementation as executable routines on computers. In fact operators are the basis for data representation and not just the basis for defining calculations to be executed. It seems as though this former perspective was missed when the redundant idea of POSSREPS was introduced, and yet strangely was made apparent when each POSSREP implicitly declared a kind of operator called a selector. I don't see your point. At the very least, I can assure you that D&D are quite aware that operators as such are "abstract" things, and that there is therefore a "model vs. implementation" wall between the operators as abstract mathematical objects (see "operators are relations"), and the implementing executable code. |
|
Let STRING be a type. POINT and STRING are distinct types. I see no need to complicate things by trying to formalise some notion of a "possible representation" of POINT involving STRING. All that's required are /explicit/ unary operators that map POINT to STRING and vice versa. Where is the complication ? The mapping operator exists in either scenario and does the same thing in either scenario. |
#15
| |||
| |||
|
|
On page 116 of An Introduction to Database Systems (8th edition) Chris Date [...] |
#16
| |||||||
| |||||||
|
|
On May 26, 5:04 am, David BL <davi... (AT) iinet (DOT) net.au> wrote: On page 116 of An Introduction to Database Systems (8th edition) Chris Date [...] David BL cites an example from that book and asks a lot of questions about possreps, sometimes using phrasing such as "Does Date think that ...", "Is it Date's position that ...". The possrep concept arose in a joint work by me and Chris Date: "The Third Manifesto", which Erwin Smout has correctly referred to in his responses, both in this thread and the earlier one on David BL's alternative proposal. I have not had time to study the entire discussions in detail but I know Erwin understands our work very well and I doubt whether I would disagree with any of his responses. |
|
David: I'm just wondering if you've actually been able to study The Third Manifesto, our proposed Inheritance Model, and the detailed rationales and discussions we have given in our books on this subject. The official versions of TTM and the IM are now in "Database Explorations" (Trafford, 2010) but "Databases, Types, and The Relational Model" (Addison-Wesley, 2007) is probably more useful because it contains the detailed discussions whereas the later book just explains why we made certain minor changes in the latest versions. If you haven't, you may find that those discussions give you answers to many of your questions. Also, my websitewww.thethirdmanifesto.com contains some material you might find useful, include the bare bones of TTM and the IM. |
|
For now, I just hope the following points about possreps and selectors are clear: 1. A selector S for type T is an operator that has certain special properties that we regard as required--and I mean required in a well- designed computer language, and I realise that opinions as to what "well-designed" entails may differ. The special properties are, quite simply, (a) every invocation of S denotes a value of type T, and (b) for every value V of type T there is an invocation of S that denotes V. |
|
2. A possrep declaration is a way of defining a signature for a selector, along with a constraint (just like your own proposed definition for numerical division, which includes a constraint to the effect that the divisor, a value of type real, must not be zero). (Btw, your idea of applying a constraint on the parameters of any operator is one that I don't think occurred to me and Date, and I find it interesting.) |
|
3. At least one selector must be available for every type, from which it follows that for every value V of every type there will be at least one selector invocation that denotes V. |
|
4. If a selector S is defined by a possrep declaration, then the parameters for S correspond to the components of the possrep. We assume that if two invocations of S differ in at least one argument, then those two invocations denote different values. Thus, if we take possrep CARTESIAN(X REAL, Y REAL) for type POINT, then the operators THE_X(P POINT) and THE_Y(P POINT) are well defined: every point has exactly one X value and exactly one Y value. We assume that the declaration of such a possrep guarantees that users of the type in question will be able to develop whatever operators they desire for that type. (So, yes, a canonical form is needed in cases like the numerator/denominator possrep for type RATIONAL. That could be addressed in the physical representation, such that THE_NUM(RATIONAL(2,4)) and THE_DEN((RATIONAL(2,4)) yield 1 and 2, respectively--a bit of a tall order! It could also be addressed by a constraint on the possrep. |
|
Some people have argued that selectors aren't always needed--in other words, they don't mind allowing a type to contain values that cannot be denoted by a single expression in the language. We admit that in practice nobody would want to invoke a selector to denote the entire content of the film "Gone with The Wind", a value of type Video, but we still think a well-designed language should make that a theoretical possibility. I don't think we could disagree with an alternative model that meets the same objectives as I have outlined above, nor would we necessarily disagree with one that fails to meet them but is perhaps intended for rather less general use, so long as its deficiencies and advantages are clear. |
#17
| |||
| |||
|
|
On Jun 13, 7:40 pm, Hugh Darwen <hughdar... (AT) gmail (DOT) com> wrote: 3. At least one selector must be available for every type, from which it follows that for every value V of every type there will be at least one selector invocation that denotes V. I find this unreasonable when I consider union types such as PLANE_FIGURE, since it would be impractical for it to have an appropriate selector according to your definition (a selector for a subtype like CIRCLE is not deemed to be a selector for PLANE_FIGURE). |
#18
| |||
| |||
|
|
On Jun 13, 7:40 pm, Hugh Darwen <hughdar... (AT) gmail (DOT) com> wrote: 1. A selector S for type T is an operator that has certain special properties that we regard as required--and I mean required in a well- designed computer language, and I realise that opinions as to what "well-designed" entails may differ. *The special properties are, quite simply, (a) every invocation of S denotes a value of type T, and (b) for every value V of type T there is an invocation of S that denotes V. I'll treat that as a very concise definition of the term "selector". As a point of clarification I note that (a) implies that a selector for type T cannot also be a selector for a proper subtype of T, and (b) implies that a selector for type T cannot also be a selector for a proper supertype of T. |
|
3. At least one selector must be available for every type, from which it follows that for every value V of every type there will be at least one selector invocation that denotes V. I find this unreasonable when I consider union types such as PLANE_FIGURE, since it would be impractical for it to have an appropriate selector according to your definition (a selector for a subtype like CIRCLE is not deemed to be a selector for PLANE_FIGURE). |
|
4. If a selector S is defined by a possrep declaration, then the parameters for S correspond to the components of the possrep. *We assume that if two invocations of S differ in at least one argument, then those two invocations denote different values. *Thus, if we take possrep CARTESIAN(X REAL, Y REAL) for type POINT, then the operators THE_X(P POINT) and THE_Y(P POINT) are well defined: every point has exactly one X value and exactly one Y value. *We assume that the declaration of such a possrep guarantees that users of the type in question will be able to develop whatever operators they desire for that type. *(So, yes, a canonical form is needed in cases like the numerator/denominator possrep for type RATIONAL. *That could be addressed in the physical representation, such that THE_NUM(RATIONAL(2,4)) and THE_DEN((RATIONAL(2,4)) yield 1 and 2, respectively--a bit of a tall order! *It could also be addressed by a constraint on the possrep. I can understand that it's important for the THE_ operators to be well defined, so I agree with your approach. *Another advantage is that the equality operator is implicitly defined. I assume the downside is that the canonical form is imposed on the selectors. *i.e. they may have constraints that make them harder to use, and this might be a source of surprise and annoyance for users, such as when a polar representation of a complex number fails because the phase wasn't in the canonical range. Some people have argued that selectors aren't always needed--in other words, they don't mind allowing a type to contain values that cannot be denoted by a single expression in the language. *We admit that in practice nobody would want to invoke a selector to denote the entire content of the film "Gone with The Wind", a value of type Video, but we still think a well-designed language should make that a theoretical possibility. *I don't think we could disagree with an alternative model that meets the same objectives as I have outlined above, nor would we necessarily disagree with one that fails to meet them but is perhaps intended for rather less general use, so long as its deficiencies and advantages are clear. I agree that the aim should be that any value can be represented by a single expression in the language. |
#19
| ||||
| ||||
|
|
On Jun 13, 1:01 pm, David BL <davi... (AT) iinet (DOT) net.au> wrote: On Jun 13, 7:40 pm, Hugh Darwen <hughdar... (AT) gmail (DOT) com> wrote: 1. A selector S for type T is an operator that has certain special properties that we regard as required--and I mean required in a well- designed computer language, and I realise that opinions as to what "well-designed" entails may differ. The special properties are, quite simply, (a) every invocation of S denotes a value of type T, and (b) for every value V of type T there is an invocation of S that denotes V. I'll treat that as a very concise definition of the term "selector". As a point of clarification I note that (a) implies that a selector for type T cannot also be a selector for a proper subtype of T, and (b) implies that a selector for type T cannot also be a selector for a proper supertype of T. As to (b), either it is wrong or overly pedantic. For one, it is perfectly reasonable (and common) to define selectors with the following signature SubType -> SuperType or in a "constructor" syntax SuperType(SubType(...)) This is no different from any other unary selector except that the single argument happens to be a SubType. Therefore, we have "trivial" supertype selectors (or "conversion operators") that serve to typecast/convert/coerce subtype values into supertype values. Finally, such selectors can be made implicit in which case the subtype selector /does/ serve as a supertype selector. |
|
As to (a), the points above also apply to SuperType -> SubType just as well. However, depending on the type system, we define impossible conversions to result in either some "default" or "invalid" value or a type exception (type system error). 3. At least one selector must be available for every type, from which it follows that for every value V of every type there will be at least one selector invocation that denotes V. I find this unreasonable when I consider union types such as PLANE_FIGURE, since it would be impractical for it to have an appropriate selector according to your definition (a selector for a subtype like CIRCLE is not deemed to be a selector for PLANE_FIGURE). See the discussion above as it answers this issue as well. Also, I note that you have not yet defined what your notions of "supertype", "subtype", etc are. Unless you have in mind some antiquated "value based" notion of inheritance (ie the one that says "a subtype is just a subset of a types domain) then these problems never arise. |
|
In other words, as long as there is a suitably rich set of operators (ie ad-hoc polymorphism), inheritance is irrelevant. Parametric and inclusion polymorphism serve only as devices of convenience, not of theoretical necessity. |
|
4. If a selector S is defined by a possrep declaration, then the parameters for S correspond to the components of the possrep. We assume that if two invocations of S differ in at least one argument, then those two invocations denote different values. Thus, if we take possrep CARTESIAN(X REAL, Y REAL) for type POINT, then the operators THE_X(P POINT) and THE_Y(P POINT) are well defined: every point has exactly one X value and exactly one Y value. We assume that the declaration of such a possrep guarantees that users of the type in question will be able to develop whatever operators they desire for that type. (So, yes, a canonical form is needed in cases like the numerator/denominator possrep for type RATIONAL. That could be addressed in the physical representation, such that THE_NUM(RATIONAL(2,4)) and THE_DEN((RATIONAL(2,4)) yield 1 and 2, respectively--a bit of a tall order! It could also be addressed by a constraint on the possrep. I can understand that it's important for the THE_ operators to be well defined, so I agree with your approach. Another advantage is that the equality operator is implicitly defined. I assume the downside is that the canonical form is imposed on the selectors. i.e. they may have constraints that make them harder to use, and this might be a source of surprise and annoyance for users, such as when a polar representation of a complex number fails because the phase wasn't in the canonical range. Some people have argued that selectors aren't always needed--in other words, they don't mind allowing a type to contain values that cannot be denoted by a single expression in the language. We admit that in practice nobody would want to invoke a selector to denote the entire content of the film "Gone with The Wind", a value of type Video, but we still think a well-designed language should make that a theoretical possibility. I don't think we could disagree with an alternative model that meets the same objectives as I have outlined above, nor would we necessarily disagree with one that fails to meet them but is perhaps intended for rather less general use, so long as its deficiencies and advantages are clear. I agree that the aim should be that any value can be represented by a single expression in the language. No, that is wrong. Any value can be represented by /at least one/ single expression. Above Hugh Darwen was discussing one particular selector S, there are arbitrarily many other selectors S1, S2, S3, ... |
#20
| |||
| |||
|
|
1. A selector S for type T is an operator that has certain special properties that we regard as required--and I mean required in a well- designed computer language, and I realise that opinions as to what "well-designed" entails may differ. *The special properties are, quite simply, (a) every invocation of S denotes a value of type T, and (b) for every value V of type T there is an invocation of S that denotes V. I'll treat that as a very concise definition of the term "selector". As a point of clarification I note that (a) implies that a selector for type T cannot also be a selector for a proper subtype of T, and (b) implies that a selector for type T cannot also be a selector for a proper supertype of T. |
![]() |
| Thread Tools | |
| Display Modes | |
| |