the topic of this post was discussed earlier in c.l.f [1] and possible
solutions were shown [2].
In 1997, it was suggested to have types and interfaces in one file and
external routines as the implementation of those interfaces in another
file.
Did different solutions or coding patterns to solve the problem of
separating interface and implementation in F90/F95 emerge since then?
Regards
Daniel
[1]
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/f0c2f853d45746f4
(Van Snyder, reply 10)
[2]
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/154579afbce7f1cb
(Artur Swietanowski, reply 19)
Daniel Franke wrote:
> the topic of this post was discussed earlier in c.l.f [1] and possible
> solutions were shown [2].
> In 1997, it was suggested to have types and interfaces in one file and
> external routines as the implementation of those interfaces in another
> file.
I think this is the only effective solution even today.
> Did different solutions or coding patterns to solve the problem of
> separating interface and implementation in F90/F95 emerge since then?
Well, submodules are what you want. But to my knowledge not a single
compiler supports them up to now.
They are part of "ISO/IEC TR 19767:2005 Fortran - Enhanced Module
Facilities".
See: ftp://ftp.nag.co.uk/sc22wg5/N1601-N1650/N1602.pdf
They are also part of the current draft of Fortran 2008 (06-007r1).
As most compiler vendors will probably first concentrate on Fortran
2003 before going beyond (TR, F2008), you most likely have to wait a
few years before you see this feature. (You could lobby your vendor if
you need it earlier.)
Tobias
> > In 1997, it was suggested to have types and interfaces in one file and
> > external routines as the implementation of those interfaces in another
> > file.
>
> I think this is the only effective solution even today.
> > Did different solutions or coding patterns to solve the problem of
> > separating interface and implementation in F90/F95 emerge since then?
>
> Well, submodules are what you want. [...]
> See: ftp://ftp.nag.co.uk/sc22wg5/N1601-N1650/N1602.pdf
Tobias,
thanks for the link. I'm not in a hurry with this. If no other
solution presents itself, the above will do. Did not want to
miss any recent development :)
Regards
Daniel
> Well, submodules are what you want. But to my knowledge not a single
> compiler supports them up to now
...
> As most compiler vendors will probably first concentrate on Fortran
> 2003 before going beyond (TR, F2008), you most likely have to wait a
> few years before you see this feature. (You could lobby your vendor if
> you need it earlier.)
While that sounds sensible, I have heard several vendor reps say
otherwise - that they have enough customer demand for submodules that
they intend to add that functionality before completing some parts of
f2003 (such as parameterized derived types, which apparently are among
the trickier things for implementors). Count that as hearsay; I heard
this in casual conversation rather than as any inside information, and
I'm sure it didn't count as anything like a commitment. So if you are
hot for it earlier, yes, it might be worth lobbying your vendor. In
fact, it might be worth more specifically because it sounds like you
wouldn't be the only customer asking for it.
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain