Re: Mixing OO and DB

From: Dmitry A. Kazakov <mailbox_at_dmitry-kazakov.de>
Date: Fri, 15 Feb 2008 12:20:46 +0100
Message-ID: <13ed47jmn6bh2.jhrlw9xfjwi0$.dlg_at_40tude.net>


On Thu, 14 Feb 2008 20:27:52 -0800 (PST), in comp.object,comp.databases.theory you wrote:

[snip, pointer issues, replied in another post ]  

>> Subtypes aren't subsets, because
>> subsets are too weak to judge about substitutability.
>>
>> One cannot reduce subtypes to subsets, or wider behavior to data.

>
> I see it slightly differently - that there are two distinct and
> incompatible notions of type. Both are important.
>
> Consider the function 1/x which is axiomatically defined on (nonzero)
> reals but not the integers. That suggests that Z is not a subtype of
> R. However consider
>
> float Invert(float x) { return 1/x; }
>
> That doesn't stop us calling Invert(2) even though 2 is only an
> integer. We still get a float result!

I think there is a confusion here. Note that invert as an operation deals with a tuple float x float:

   Invert : float -> float

Now, the question is where are you going to substitute ints?

  1. In the first appearance of float
  2. In the second one (result)
  3. In both

Depending on that Invert will become inheritable or not. I.e substitutability is not only parameter mode depending, it also depends on the concrete parameters too. (For the sake of genericity, results are parameters.)

> As another example, I think a language can rightly support implicit
> upcast of 16 bit integers to 32 bit integers. Of course we have to
> keep in mind that the modulo 2^16 operators are distinct from the
> modulo 2^32 operators.

Also, these examples are all about specialization vs. generalization. Which are "relatively" simple. But there are much more difficult cases where there is no any injective mapping between two sets. Yet substitutability is highly desired. Consider two color models. Most colors would have a representation in both models, but some colors would be unique in either. Or take fixed point and floating point numbers.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Received on Fri Feb 15 2008 - 12:20:46 CET

Original text of this message