| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Clean Object Class Design -- Circle/Ellipse
Martijn Meijering wrote:
>
> I'd like to get away from discussing Date's understanding or lack of it.
> Can't we just talk about whether we think a decent OO type system should
> allow (not force) the integers to be a subtype of the reals and why that
> would be useful?
If you take Date's vision on OO and use a simply type system (no parameterized types or types with quantifiers of types, et cetera) then this is a well-understood problem. You can find the relevant literature under 'multimethods' and 'subtyping' with Google.
To summarize:
Assume you have a finite set of domains Dom = { D_1, .., D_n } and a } finite set of function Fun = { f_1,..., f_n } over these domains (with some of them the same name but over different domains). If you assume a subtype ordering, here called <=, over the domains then there are two things that should hold.
I[C_i,C']( f_i( I[D',D_i](x) ) ) = I[C_j,C']( f_j( I[D',D_j](x) ) )
So if you tell me what operations you have over the integers and the reals, and what your subtype interpreations is, then I can tell you if a subtyping relation between them is valid.
For starters lets assume for the Reals (R,+,*) and for the Integers (I,+,*). So we have the domains R and I and the operators + : R x R -> R, * : R x R -> R, + : I x I -> I and + : I x I -> I. And because I have to get back to work now, checking that we can indeed regard the integers as a subtype of the reals is left as an exercise for the reader. :-)
Kind regards,
-- Jan HiddersReceived on Mon Aug 06 2001 - 04:57:36 CDT
![]() |
![]() |