<[log in to unmask]> wrote:
> I would like to know if it's possible to define a type and an interface
> bloc with procedures using this type in
> the same module
No. Interface bodies do not access their environment by host association.
Therefore, you need to put the type definition into one module and the
interface into another. Then, from within the interface body, USE the
module in which the type definition appears. I consider it good style
to put the "only" clause on USE statements.
> And secondly, I just begin witf F90 so do you know if it's better to
> make :
> - module with interface bloc
> or
> - module with functions and procedures
In most cases it is better to write a modules that contain your types,
functions, subroutines and named constants. Procedures in a module DO
access their environment by host association, so you wouldn't need to
put your types in a separate module. If you want your types to be
opaque, i.e. have private components, you MUST put them in the same
module as the procedures that manipulate them.
If you are incorporating legacy, i.e. Fortran 77, code, it may be easier
to write interface blocks than to wrap modules around them -- especially
if you don't have source code!
Otherwise, I write interface bodies only for dummy procedures.
--
What fraction of Americans believe | Van Snyder
Wrestling is real and NASA is fake? | [log in to unmask]
Any alleged opinions are my own and have not been approved or disapproved
by JPL, CalTech, NASA, Dan Goldin, George Bush, the Pope, or anybody else.
|