Re: Implementing JAVA interfaces in FORTRAN 20xx



On Aug 25, 10:31 am, fj <francois.j...@xxxxxxx> wrote:
On 25 août, 10:21, Reinhold Bader <Ba...@xxxxxx> wrote:

fj schrieb:

I don't want to use the inheritance here (because F2003 supports only
a single inheritance). For instance, I want to be able to declare
something like that :

  type, extends(roottype), implements(ordered_type) :: mytype

Well, your initial example did not indicate this. In any case, this is a
form of limited multiple inheritance which indeed is not supported explicitly.
You can however have a type definition

type, extends(ordered_type) :: mytype
   type(roottype) :: r
   :
contains
   : ! map needed TBPs of roottype, as well as deferred methods of ordered_type
end type

which will do the equivalent with only a little additional wrapper code..
If you need to override roottype methods anyway, the needed programming effort
is in fact the same.

[...]

Regards

But this is a pity because extending an abstract type associated with
predefined routine signatures is much easier than extending a actual
type.

And because this is much easier, it is possible in JAVA to extends
(more precisely to implement) as many abstract types (JAVA interfaces)
as necessary when it is possible to extend only a unique actual type
(single inheritance).

Please explain how this does any real good in Fortran at all. As I
understand it, you can not pass an array of integers to a routine
which expects an array of elements, each of which is of derived type,
each of which consists only of an integer.

- e





.



Relevant Pages

  • Re: Implementing JAVA interfaces in FORTRAN 20xx
    ... a single inheritance). ... form of limited multiple inheritance which indeed is not supported explicitly. ... predefined routine signatures is much easier than extending a actual ... as many abstract types (JAVA interfaces) ...
    (comp.lang.fortran)
  • Re: Implementing JAVA interfaces in FORTRAN 20xx
    ... form of limited multiple inheritance which indeed is not supported explicitly. ... In fact I just wanted to show that extending abstract types could be ... because you do not inherit neither data (the abstract type is empty) ... mesh and a "concrete" mesh have practically no common fields. ...
    (comp.lang.fortran)
  • Re: Java "interface" vs. OO interface
    ... >> to MI adds an order of complexity to reading code that isn't needed. ... Single Inheritance and Mix-Ins ... Single inheritance is good because the whole class inheritance structure ... most common kind of abstract class. ...
    (comp.object)
  • Re: COBOL and Java Relative Perceived Power
    ... that doesn't,of itself, violate encapsulation. ... because both the current override and the super class are ... inheritance, I don't think it is important enough to make me NOT inherit, ... It is also safe to use inheritance when extending classes ...
    (comp.lang.cobol)
  • Re: COBOL and Java Relative Perceived Power
    ... Extending it makes its methods ... "visible" but that doesn't,of itself, violate encapsulation. ... Overriding a super class method in a subordinate class doesn't ... I agree that inheritance can be overused, ...
    (comp.lang.cobol)