[self-interest] resend (was: Multiple inheritance)

J. Baltasar Garcia Perez-Schofield jbgarcia at uvigo.es
Mon Nov 7 16:33:59 UTC 2005

	Dear Jecel:

	Thank you again for your explanation.

> ( | parent* = traits clonable.
>      sharedStuff* = mixins utilities. "just an example - not in Self
> distribution"
>      moreStuff* = mixins graphics. "another example"
>      subElements <- list copyRemoveAll.
>      copy = ( | new |
>                     new: resend.copy.
>                     new subElements: subElements copy.
>                     new ).
>       .....
> | )
> The "resend.copy" will do exactly the same (full) search that just
> "copy" would have done except it will skip the local methods in the
> object, which in this case is the very method doing the resend.

	Yes, as "super" in Java.

>  That
> means that any copy slots in "parent", "sharedStuff" and "moreStuff"
> will be found and if there is more than one then a debugger will pop up.

	That's the point.
	But I suppose that this means that at runtime time, each time a
resend/"unqualified" message is sent, and more than one parent is found
for the receiver (and provided the receiver can't satisfy the message),
then all inheritance paths are explored in order to avoid the
possibility of finding more than one receiver (and show the debugger if
	This can't be limited to the first time because Self is dynamic, the
inheritance paths can change after a message is carried out due dynamic
inheritance. So Self has to do it every time, and I guess this is quite
	Or maybe I am missing something ?

	The depth search is maybe problematic in some sceneries, but is
obviously better in the best case (the receiver is found in the first
inheritance path) and in the average case, though equal in the worst

> An alternative would be to replace "resend.copy" with "parent.copy" (for
> example) and in that case a "copy" slot in either "sharedStuff" or in
> "moreStuff"

	More or less as in C++ with "SomeParent::foo()", I guess. Yes, I
understand you can void any search by directly indicating the
"inheritance path" you are interested in.

> Some people prefer a depth first search but that has a nasty side effect
> that just changing the order of "sharedStuff" and "moreStuff" in the
> above code could change its meaning!

	However, is it likely to happen ?. I mean, if a programmer knows that
order of parents in the parent list (whatever syntax you choose) has a
meaning, would that programmer change the order of parents without
noticing ?



PBC -- J. Baltasar García Perez-Schofield
jbgarcia en uvigo de es  http://webs.uvigo.es/jbgarcia/
Dep. Informática, Universidad de Vigo, España (Spain)

More information about the Self-interest mailing list