(j3.2006) (j3.2005) Re: question on token replacement/concatenation

Aleksandar Donev donev1
Tue Jan 2 18:24:47 EST 2007


Bill Long wrote:

> Suppose we do decide on a future syntax use for { } in actual Fortran 
> statements.  I seems like we could run into a new set of conflicts with 
> your proposed usage in macros.  If those conflicts can be overcome, then 
> it would seem that the same conflicts could be resolved if you chose to 
> use ( ) as the delimiters for the macro arguments instead. For example, 
> the outermost enclosing parens around a macro actual argument are 
> removed before substitution takes place.
Sure, technically this works since the nesting of the parens inside the 
macro actuals are restricted to be proper. However, I think the above 
would be very suprising to users, and cause more errors than bring 
improvements. This is because parenthesis are used soo much and so I 
expect that they would be frequently used in macro actual arguments, so 
that double parenthesis would be used often:

EXPAND M(X=((X+1)))

The advantage of using curly braces is that they are not used now, which 
means that users can easily get accustomed to their use. Sure, at some 
point in the future one may need to use double curly braces around a 
macro actual argument, but by then users would know that the curly 
braces around a macro actual argument "disappear".

> I'd rather reserve { } for 
> something more significant. 
Sets perhaps :-)

> Perhaps enclosing an inline macro implied 
> DO construct that could be used to form variable length lists (to 
> generate rank-independent subscript lists, for example).
Cute, but I don't see how this conflicts with also using them around 
macro actuals. Just use double curly braces and you get a 
variable-length list as a macro actual.

Aleks



More information about the J3 mailing list