Re: Fortran 2003: abstract interfaces



Arjen Markus <arjen.markus@xxxxxxxxxx> wrote:

Yes, that is a clear explanation. It does mean that
"abstract interface" and "interface", despite having
the same noun, are two different concepts. Not precisely
orthogonal, as the term seems to be, but the one is not
a special case of the other.

I disagree. Well, I do agree that there are plenty of confusing terms,
and I even think that there is an odd mixture of concepts related to
interface blocks, but I don't think the above is one of them.

I'm suspicious that you are confusing an interface and an interface
block. While they are related, they are not the same thing. An interface
is a set of properties of a procedure. (I could look up the exact list
of properties, but I'm feeeling to lazy). An abstract interface is most
of the same list of properties, but excludes the procedure name from the
list. It is abstract in that it is not attached to a particular
procedure. You can use a procedure statement to specify that a
particular procedure has a particular abstract interface, thus
specifying the interface of that procedure.

The bit of syntax that starts with the keyword "interface" is not an
interface. That is an interface block. I do find some things about
interface blocks confusingly mixed. In particular, I think that
interface blocks serve two largely orthogonal functions, which would be
more clearly done with two separate pieces of syntax.

1. An interface block can define one or more interfaces. This includes
both abstract interfaces and what I might call concrete ones (but the
standard doesn't; it just calls them interfaces without a qualifier).
This functionality is in the form of interface block that starts with
just plain "interface" or with "abstract interface". Such interface
blocks always have interface bodies in them, as teh interface body
actually defines the interface (or abstract interface), which is what
these are about.

2. An interface block can define a generic. This includes generic
procedures, generic operators, assignment (which is generic, though we
don't tend to use the modifier), and defined I/O (which is also
generic). This is done by the forms of interface block that start with
"interface <name>" and the other variants. Basically, this form of
interface body specifies what specifics are included in the generic.
Ideally, in my view, these interface blocks should have nothing but a
list of procedures (and thus could be done in a single statement instead
of a multi-statement syntax). And I'd probably have used the keyword
"generic" somewhere in their syntax.

To me, the confusion arises in that the two roles can be mixed in the
generic interface block. You can put an interface body in a generic
interface block. That both defines the interface (always a concrete one)
and also specifies that the procedure whose interface was just defined
is part of a generic. It might save a step, but I find the mixture of
roles hard to explain well. The best way I can do it is to point out
that it is such a mixture.

See the handbook when it comes out for a longer-winded (what else from
me? :-)) version of this explanation.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.