Template metaprogramming 
Author Message
 Template metaprogramming

Are templates for metaprogramming available with fortran ?

http://www.*-*-*.com/



Sat, 27 Aug 2011 18:55:17 GMT  
 Template metaprogramming

Quote:
> Are templates for metaprogramming available with Fortran ?

> http://en.wikipedia.org/wiki/Template_metaprogramming

Not as such, no, but if you are looking for generic programming
techniques,
Fortran 90/95 does offer a few possibilities (*) and Fortran 2003, the
new
standard, incorporates quite a few. Actually, that does have template-
like
features.

Regards,

Arjen

(*) Not all of these possibilities are very obvious, but I use a few
in
    my Flibs project - http://flibs.sf.net
    I have come to realise that there is at least one more feature
that
    you can exploit in this way, but I'd like to write that one down
    first ;).



Sat, 27 Aug 2011 19:52:12 GMT  
 Template metaprogramming

Quote:

> > Are templates for metaprogramming available with Fortran ?

> >http://en.wikipedia.org/wiki/Template_metaprogramming

> Not as such, no, but if you are looking for generic programming
> techniques,
> Fortran 90/95 does offer a few possibilities (*) and Fortran 2003, the
> new
> standard, incorporates quite a few. Actually, that does have template-
> like
> features.

> Regards,

> Arjen

> (*) Not all of these possibilities are very obvious, but I use a few
> in
> ? ? my Flibs project -http://flibs.sf.net
> ? ? I have come to realise that there is at least one more feature
> that
> ? ? you can exploit in this way, but I'd like to write that one down
> ? ? first ;).

My limited understanding of this area is that Fortran 2003's derived
type parameters (DTP) is Fortran's version of generic programming
(which I'm taking to be synonymous with "metaprogramming" but I can't
access the provided link for some reason right now). DTP are integer
values that can be used to set type attributes such as precision and
array  bounds.  In this regard, they are similar to C++ integer
template arguments except that the latter must be set at compile-time,
while DTP can be set at runtime.

I think Cray is the only compiler vendor who has implemented DTP.

Several months ago, there was a long and interesting thread on this
newsgroup in which we discussed several approaches to emulating
templates in Fortran.  I suggest searching for that thread.

Damian



Sun, 28 Aug 2011 01:15:25 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. C++ Template Metaprogramming

2. Metaprogramming: C++ templates vs Scheme macros?

3. Metaprogramming: C++ templates vs Scheme macros?

4. Metaprogramming resources

5. Metaprogramming ( was Re: evolving lisp)

6. metaprogramming

7. Metaprogramming ( was Re: evolving lisp)

8. Prevalence of metaprogramming (was: Forth like interpreter)

9. Metaprogramming in Oberon

10. How does Metaprogramming work?

11. Metaprogramming and multiple inheritance

12. PROPOSAL: Metaprogramming in Python

 

 
Powered by phpBB® Forum Software