

A new kind of inheritance in programming languages? - nreyntje

Hi, I may have discovered a new kind of inheritance while building my product, its called deep inheritance and it allows for much more contextual information.<p>Its hard to explain, its described here: http:&#x2F;&#x2F;www.solebase.com&#x2F;psychological-basis.html<p>Tell me, is it as useful as I think it is? Is it unique? Or is it only useful in theory?<p>I&#x27;m curious about your answers...
======
onaclov2000
I've actually had similar thoughts about this, basically an objects becomes
another object based on context, in your case you're "adding" elements to the
object, however I had been thinking that just simply creating a bunch of
objects with different properties, and whenever it is in a state that it can
become that object (due to an action on it), it automatically is typecast to
that type of object and referred to as that from there forward, I've never
tried it, but it was just a thought. Interesting read.

------
SparK-Cruz
You are not inheriting behaviour, you are inheriting values of a list. You
could simply instanciate a new object of the child type, access the parent
type attributes and set it to the child. This could also work with a
constructor or a valueOf method.

If you are looking for dynamic languages, see JavaScript and Ruby.

------
benji-york
This is called Acquisition. See
[http://c2.com/cgi/wiki?AcquisitionInheritance](http://c2.com/cgi/wiki?AcquisitionInheritance)

~~~
rivd
the c2 article speaks of the difference between dynamic scoping and
acquisition as the former being dependent on call context and the latter on
"where you put it".

Can i conclude acquisition can be done in javascript by binding function
objects ?

var fn = somefunc.bind(other_object)

Or is this still dynamic scoping because it only sets the value of this for fn
?

