(j3.2006) Suppress macro token replacement
Aleksandar Donev
donev1
Wed Jan 3 17:44:40 EST 2007
Hello,
In thinking about keywords for macro actual arguments, I realized that we
still need a mechanism to suppress token replacement in certain cases, so
that a lexical token that happens to be X may remain as just an X and not be
replaced when X is the name of a macro dummy argument. For example, in
MACRO M(X)
EXPAND Y(X=X)
END MACRO
it would be nice if it is possible to use X as a keyword. Maybe this is too
much to ask, but it seems to me that programmers are used to Fortran syntax
where the lexical token X can be used for several different purposes
(variable name, keyword, label, etc.) without ambiguity. Maybe a way to
unquote a string would do it. Using fake $ syntax to denote a "macro
function":
EXPAND Y( $UNSTRING("X") = X )
Yet one more rather useful macro feature present in other macro languages is
the ability to "quote" (convert to string) after expansion:
WRITE(*,*) "Compiled for type=", $STRING(TYPE)
where TYPE may be replaced with "INTEGER(wp)", for example.
I am not sure what good syntax for these would be, but they seem rather useful
yet absent...
Aleks
More information about the J3
mailing list