Re: changing module files
From: John Lansberry (john.lansberry_at_jhuapl.edu)
Date: 12/17/03
- Previous message: Clive Page: "Re: National Labs, Fortran, and free compilers"
- In reply to: Tony Jay: "Re: changing module files"
- Next in thread: Dan Nagle: "Re: changing module files"
- Reply: Dan Nagle: "Re: changing module files"
- Reply: Dave Thompson: "Re: changing module files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 17 Dec 2003 08:51:49 -0500
Interestingly (at least to me), this whole thread is very closely related to
my previous post (Will Fortran 2003 Solve This Problem).
For me, the fact that modules must be compiled is a major obstacle to object
oriented (OO) programming. That is, objects of different classes
(definitions of which are encapsulated in modules) cannot USE each other
(directly or indirectly).
C++ header files avoid that problem, because header files only declare the
INTERFACE to class member functions. Whether any such member function is
actually defined somewhere is not determined until compile time. Hence, if
the header file is wrong (provides the wrong list of arguments to a
function), you won't know about it until link time in C++. I'm no fan of
header files. I think they are ugly and prone to errors. Plus, you need to
understand and be comfortable with all of the preprocessor macros. IMHO,
requiring the use of a preprocessor to get something to compile and link
represents a fundamental flaw in the design of the language.
The concerns with module files are not new. Dan Nagle (in thread mentioned
previously) refers to the "Enhanced Modules" series of papers by Van Snyder
(www.j3-fortran.org). Mr. Synder makes the very same point that a change to
MODULE_A may cause a ripple effect of re-compiling all other modules that
USE MODULE_A, even if the INTERFACES to MODULE_A member functions (and/or
TYPE definitions in MODULE_A) have not changed. Apparently, that issue is
going to be addressed in some form (via submodules or something - I'm fuzzy
on the details).
John
"Tony Jay" <Tony.Jay@nospam.bsac.com> wrote in message
news:vu0g9me94je206@corp.supernews.com...
> Yes.
>
> but a good implementation of .mod files (hopefully in IF 8) does not
require
> recompiling if the .mod files have not changed (apprently easy to do by
> creating a temp .mod and only over write the original one if they are
> different, hence the time stamp does not change)
>
> Just because the implemention of the compiler is not in a standard does
not
> mean that we should not expect compiler writers to give us a good
> environments to work in . I do not know the fortran standard, but i expect
> it contains very little or nothing on how a debugger should work in
> fortran - yet i expect to be able to investigate the value of my
variables.
>
> I would be interested to see which compilers do not use .mod files, it
must
> be quite hard to check the interfaces at compile time if there is nothing
to
> check against. Checking interfaces only at link time would make library
> maintenace fun. I doubt the linker would be able to correctly report
> problems of trying to access a private variable in a module. (I assume I
use
> the c++ linker to link my fortran )
>
> Tony Jay
>
> "Jan C. Vorbrüggen" <jvorbrueggen@mediasec.de> wrote in message
> news:3FE02CDD.400718CA@mediasec.de...
> > As I understand it, the writers of the Fortran standard wanted to offer
> > more than just the interface functionality to compiler writers and
> > programmers. For instance, in C++ you need to put part of the
> implementation
> > into the header file if you want those parts to be inlineable. So now
> > your implementation is in two different places...bad, very bad from a
> > sofware engineering point-of-view. In F90, all is in the actual source
> > file, and the compiler writer must put the interface information into
> > the module file, but he may decide, for instance, to include some
routines
> > in a way that they can be inlined by the module's USErs. In fact,
nothing
> > in the standard, AFAIK, _requires_ modules files to exist: a USE could
> > just as well refer to the same file/entity as is later used for linking.
> >
> > Given that, your makefile needs to be conservative and remake all users
> > of a module file if it was re-written.
> >
> > Jan
>
>
- Previous message: Clive Page: "Re: National Labs, Fortran, and free compilers"
- In reply to: Tony Jay: "Re: changing module files"
- Next in thread: Dan Nagle: "Re: changing module files"
- Reply: Dan Nagle: "Re: changing module files"
- Reply: Dave Thompson: "Re: changing module files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|