(j3.2006) (j3.2005) Re: question on token replacement/concatenation
Aleksandar Donev
donev1
Fri Dec 1 13:02:36 EST 2006
On Friday 01 December 2006 00:29, Malcolm Cohen wrote:
> Rather than discuss the dead document 06-007r1, if we cannot be
> bothered to hunt up the relevant meeting papers we should be patient
> enough to wait for 07-007.
We are supposed to be *checking* 07-007, not trying to understand what Malcolm
intended by reading it. This is why we pass specs and discuss things---we
assume we know what we want the standard to achieve and then we check it to
make sure it says it well and consistently. So first we need to agree on what
we want to happen here.
I personally find it a bad design to allow something that started as one
"pre-token" (call it macro lexical token) a%%b%%c to expand into two lexical
tokens. One should simply not be allowed to have spaces or other separators
inside b. Yet alone new lines, which thankfully seem to be forbidden.
Similarly, we should not allow spaces around the %%'s, "a %% b" should not be
allowed.
While I understand that macros gain flexibility and ease of implementation
when viewed as munching strings together and dumbly replacing them, I thought
we were aiming at providing a more "Fortran-like" and controlled macro
mechanism than simple textual replacement. After all, there are many tools
out there that already do textual macro processing...I am using one every
day. We only provide statement-level macros, which greatly limits macro
flexibility. So we might as well tighten macros so they provide some error
prevention.
There are some other design questions about token replacement which bother me.
Should we allow a statement such as:
DO_THIS
to expand to an actual Fortran statement, say "x=1.0", or "REAL X"? We seem to
allow it, since = and spaces may appear in a macro actual argument value. Is
this really wise. I think that the only way to get a complete statement or a
sequence of statements inside a macro should be to pass a macro actual
argument and then EXPAND it, as in
EXPAND DO_THIS()
We should think more carefully about what we want to allow as macro actual
arguments. This has nothing to do with which version of 007 one is talking
about, it is spec, not syntax and edits.
Best,
Aleks
--
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