[log in to unmask] writes:
> All are truly GENERIC, that is the enclosed value types are
> "parameterised", without ANY modification to the data structure module itself.
Hmm. How does one do that?....
> You might see the content in the following web page:
>
> http://www2.cnam.fr/~lignelet/sd_f90_gb.html
After a quick glance at the example there, I see. Yes, that would
work for a single case. Unless I missed something, though, there
isn't a way to make this work directly for 2 different value types
in the same program. The code uses a module named pile_generic to
define the element type. It does, thus, nicely illustrate a strong
isolation between the element definition and the algorithm. The
module implementing the algorithm does not need to be modified at
all to handle different element types - you just need to modify the
pile_generic module that defines the type.
But if you want implementations for 2 or more different types in the
same program, then you'll need two different versions of the
pile_generic module, which implies two different module names,
which implies two different copies of the algorith module. The
copies of the algorithm module don't need to be very different.
Looks like just a one-line change to replace the name pile_generic
in the USE statement. This is the kind of thing I had in mind when
I talked about having a template that could be modified by tools
outside of Fortran (something to make the multiple copies of the
source, each with the trivial change). (This idea, of course, is
*far* from original to me).
Does look, as well as I could see at a quick glance, like a well-done
implementation of such an idea. From the brief description cited
above, I didn't realize that this was the kind of scheme you were
talking about, but the code certainly seems put together in a way to
support such templating.
--
Richard Maine
[log in to unmask]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|