(j3.2006) question on token replacement/concatenation

Aleksandar Donev donev1
Tue Dec 5 14:29:55 EST 2006

On Monday 04 December 2006 19:17, Malcolm Cohen wrote:

> Earlier, you wrote
> ]] Should we allow a statement such as:
> ]]
> ]] DO_THIS
> ]]
> ]] to expand to an actual Fortran statement, say "x=1.0", or "REAL X"?
To clarify my inconsistency. Upon reflection, I have no problem with

macro Components(attribute, other_attribute)
 attribute ! default accessibility
        real, other_attribute :: x
end macro

because the actual argument:

expand Components(PRIVATE)

is simply a keyword (a name?), not some arbitrary weird sequence of tokens.

But I still find

expand Components (attribute = real :: y=1, public) ! Add a real component y

not acceptable in Fortran syntax, leading to errors, weirdness with 
concatenation inside the macros, and simply awful (worse than C) readability.

As to

expand SomeMacro ( argument=x=1)

producing the assignment statement


I think it is a straw-vote type decision. I would personally not allow it, but 
that may be too restrictive.

This is of course OK:

expand SomeMacro ( argument=INTEGER(KIND=1) )

since the equals is embedded inside a pair of delimiters.


Aleksandar Donev, Ph.D.
Lawrence Postdoctoral Fellow @ LLNL
High Performance Computational Materials Science and Chemistry
E-mail: donev1 at llnl.gov
Phone: (925) 424-6816  Fax: (925) 423-0785
Address: P.O.Box 808, L-367, Livermore, CA 94551-9900
Web: http://cherrypit.princeton.edu/donev

More information about the J3 mailing list