Re: (OT)Dynamic inheritance (was: Object support in the relational model??)
Date: Tue, 28 May 2002 22:55:03 GMT
Message-ID: <bVTI8.10615$UT.708096_at_bgtnsc05-news.ops.worldnet.att.net>
"Carl Rosenberger" <carl_at_db4o.com> wrote in message
news:acvk24$hv$00$1_at_news.t-online.com...
> Dan Muller wrote:
> > > > Maybe inheritance is the wrong approach and we need a
> > > > more loosely coupled system of dynamic delegates.
> > > > (Tables and relations? :-) )
> >
> > I'm not exactly sure what you mean by "dynamic delegates", but it sounds
> > interesting. :-)
>
>
> // Here is the setup:
>
> class Foo{
> delegate Bar bar;
>
> }
>
> class Bar{
> void fly(){
>
> }
> }
>
> Foo foo = new Foo();
>
>
> // Here is the beef:
>
> foo.fly();
>
>
> The above method will try to find a "fly" method in
> the Foo class. If it is not successful, it will search
> all delegates, in the order of declaration, for a
> valid object that supports the method.
> Clue No.2: If it is not successful, it will search all
> the delegates for further delegates.
>
> The concept will cover all aspects of multiple inheritance,
> so you will not need to have "normal" inheritance.
>
> Additionally it is possible to change the values of
> delegates at runtime. This would for instance make it
> possible to "promote" an "employee" to be a "manager".
Wandering off-topic...
Aside from the last bit about dynamically changing delegates, it doesn't
sound any different than inheritance in C++. But when you add the
dynamicism, it's very different. Assuming that the basic interface of the
delegates is determinable at compile-time (i.e. you couldn't replace an
'employee' delegate with a 'dairy_cow' delegate), you can implement such
'dynamic inheritance' behavior in C++ using abstract interfaces and
forwarding member functions. (But further detail would be *extremely*
off-topic for this newsgroup, and you're probably familiar with this
already. Jim Coplien's slightly dated
"Advanced ++ Programming Styles and Idioms" discusses it in some depth, if I
recall correctly.)
Strolling closer to the path...
Date & Darwen's programming model separates data and action fairly strictly, yet still provides all the important types of polymorphism. This idea has really started to appeal to me -- the common OO inheritance models seem to bundle too many orthogonal concepts together. I'd like to see what a language would turn out like if it started from D&D's Tutorial D and added good module/package features, like Modula-2 or Ada. I suspect that it would be very flexible. Received on Wed May 29 2002 - 00:55:03 CEST