Re: optional or interface



Arjen Markus wrote:
On 3 jun, 18:30, Paul van Delst <Paul.vanDe...@xxxxxxxx> wrote:
Richard Maine wrote:
Paul van Delst <Paul.vanDe...@xxxxxxxx> wrote:
Erm.. I'm not quite sure what you mean here. I use INTERFACE for
overloading, of course, but that's it. I don't use interface blocks (don't
see the point since I use modules). What do you mean by similar? Specific
to generic procedures?
You mean that you don't use interface bodies. An interface block is the
only way to define a generic. Yes, I realize that those two terms are
easy to confuse; I've regularly confused them myself.
Yep, you're right. I always confuse the terms. Thanks for catching that.

So, to be clear to the OP, I don't use interface bodies. (Keeping in mind that's a design
decision I made, not an indictment against interface bodies.)

cheers,

paulv

Interface bodies come in quite handy for situations where you can not
put the routine in a module:

Oh, yes, I quite agree. That was why I put in my parenthetical comment: it's a design decision on my part to not need interface bodies.

- You only have the compiled version of a library
- The library is written in a different language (like C for instance)

Even in these cases (at least, for the first one) I use wrapper routines that are in their own module (e.g. for accessing the lapack library).

In the interest of full disclosure I should state that I am somewhat biased against interface bodies because the same information is specified in two different locations. One always has to ensure that when changes are made, both locations are updated. Or, more preferably, one has a tool that generates the interface bodies automatically from the procedure interface itself.

cheers,

paulv

By using such interface bodies you get the same validity checks as
with
modules, though it takes more work and you need to be careful in
specifying
the interfaces.

I have made it a rule for myself to put these interface bodies in a
module of
their own or part of a related module.

Regards,

Arjen
.



Relevant Pages

  • Re: compilation problem with module function interface definition
    ... > The module compiles cleanly with the interface block commented out. ... there is no need to repeat it in an interface body. ... About the only times you need interface bodies are for external ... the declaration of the type ...
    (comp.lang.fortran)
  • Re: interface blocks
    ... > interface block at least makes sense, ... hold the prototype for all subroutines. ... Interface bodies can ...
    (comp.lang.fortran)
  • Re: interface blocks
    ... I am considering building a generic interface ... Interface bodies can ... (the call, the procedure, and the interface body). ... and there are various annoyances in terms of writing the interface ...
    (comp.lang.fortran)
  • Re: optional or interface
    ... to generic procedures? ... I always confuse the terms. ... So, to be clear to the OP, I don't use interface bodies. ...
    (comp.lang.fortran)
  • Re: optional or interface
    ... I don't use interface blocks (don't ... to generic procedures? ... So, to be clear to the OP, I don't use interface bodies. ...
    (comp.lang.fortran)