Re: Canonical DB

From: Dmitry A. Kazakov <>
Date: Sat, 24 Jun 2006 21:31:38 +0200
Message-ID: <1g8lx513bhsk8.17eyaezihmiwv$>

On Sat, 24 Jun 2006 14:18:26 +0200, mAsterdam wrote:

> Dmitry A. Kazakov wrote:

>> mAsterdam wrote:

>>> ...A correct model would have the constraints
>>> in place to preserve the invariant of the
>>> structure while allowing all valid modifications.
>> Yes. But the problem is (apart from expressing the constraints, which
>> itself might be far from trivial: like an acyclic graph constraint etc),
>> that you might lose the structure. 

> Is your 'lose the structure' just another way of
> stating 'the invariant is not preserved',
> or is there more to it?

Sort of. Though one could argue that the invariant is in some sense the structure abstracted from the elements.

>> To me this all is the infamous LSP problem. 

> LSP? Label-switch path as in
> ?

Liskov Substitutability Principle

Alas, but LSP does not work, for the reason that any non-trivial modification of a structure changes it, and so produces a different structure.

>>>I tried modeling the C3 MRO relationally
>>>but haven't found a solution (or the conviction
>>>that it can't be done) yet.
>>>and (background)
>>>It is a nice (and IMHO very useful) challenge.
>>>Any takers?
>> Ah, multiple dispatch, it is a hard problem. I'm unsatisfied with presently
>> existing solutions.
>> BTW, it might be interesting to consider relational structures of types.

> Yes, please. Could you provide some background
> (and maybe some references to/elaboration on to presently
> existing solutions)?

In short, what I want is that dispatch would never fail. I.e. either an operation is properly inherited or it is overridden. Then I want to be able to handle exponential growth of variants. In particular I want to be able to express symmetries, like in commutative operations (+,*) and ones with an inverse (-. /). I also want to be sure that overriding be consistent, i.e. overriding real+int would also force me to override real+real (while int+real be deduced).

For relational structures I have only a vague idea. But there is a bad problem of parallel type hierarchies. For example: you have one hierarchy of types and another of pointers to them. Or containers of, or whatsoever. It could be a candidate for some relational algebra on the types. Maybe all type relations (derived-base, container-element, pointer-target, function-argument etc) could be unified in some way. Maybe it is just rubbish, I don't know.

Dmitry A. Kazakov
Received on Sat Jun 24 2006 - 21:31:38 CEST

Original text of this message