[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Renaming at inheritance (was: Re: [Axiom-developer] Curiosities with Axi
Renaming at inheritance (was: Re: [Axiom-developer] Curiosities with Axiom mathematical structures)
Wed, 1 Mar 2006 09:49:09 +0100
27 Feb 2006 17:08:27 +0100, Gabriel Dos Reis <address@hidden>:
> | One reason for having Monoid and AbelianMoniod (one with "*" and the
> | other with "+") is that neither SPAD nor Aldor allows to rename
> | functions during inheritance.
> yes, that is true for many (all?) object-oriented languages.
Not all, Eiffel can rename methods when inheriting:
class C inherit
A rename x as x1, y as y1 end;
B rename x as x2, y as y2 end
Here, if both A and B have features named x and y, class C would be
invalid without the renaming.
Renaming also serves to provide more appropriate feature names in
descendants. For example, class WINDOW may inherit a routine
insert_subtree from TREE. For clients of WINDOW, however, such a
routine name is no longer appropriate. An application using this class
for window manipulation needs coherent window terminology, and should
not be concerned with the inheritance structure that led to the
implementation of the class. So you may wish to rename insert_subtree
as add_subwindow in the inheritance clause of WINDOW.
|[Prev in Thread]
||[Next in Thread]|
- Renaming at inheritance (was: Re: [Axiom-developer] Curiosities with Axiom mathematical structures),
David MENTRE <=