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

Malcolm Cohen malcolm
Tue Jan 23 05:22:57 EST 2007

Aleksandar Donev said:
> On Monday 22 January 2007 14:11, Dick Hendrickson wrote:
> > Do we
> > want to allow people to manipulate macro things that have an "_"
> > or "%" as the leading character (or maybe don't qualify as lexical
> > tokens for some other reason)?

See other message for "percent isn't a problem already".

> Originally I would have said no, this kind of string-based hacking
> of macros should not be allowed. But, since it seems we allow rather
> bizzare and hacky macro catenations anyway.

Thanks for your opinion, which strangely enough I don't agree with.

There are some aspects of Fortran lexical structure which I am
guessing you would already describe as "bizzare" (sic) and "hacky"; so
to the extent that macros should work with such things, I suppose they
should be hacky too.

> For example, "**3" is perfectly valid as a lexical token sequence
> even though it makes no more or less sense than "%component".

And both are already allowed.

> We should be consistent and simply allow everything that can be
> inambiguously parsed.

I believe that's essentially what we are aiming at,
but at the lexical level not the textual level.

We really don't want people to have to do significant rewriting
of their Fortran lexical analysers.

> I still believe we need to add syntax to delimit such macro 
> arguments, so as to allow commas and semicolons,

There is no argument from me that this would not be a nicety.
Lots of other macro processors don't have such niceties though...

> which seem to me more important than "%a" or "_3".

I could not agree less.  Kind parameters are really basic.
We should be able to work with them.

Given the lack of support for "comma hackery" in many other macro
processors, I am obviously not alone in personally considering that
particular frippery to be way down the list of desirable goodies.

........................Malcolm Cohen (malcolm at nag-j.co.jp), Nihon NAG, Tokyo.

More information about the J3 mailing list