I'd like to suggest to let m4 discard comments in a future version. By
comment, of course I mean everything between # and newline, or the
comment delimiters set by m4_changecom macro.
My suggestion is to add a command line option so m4 discards comments,
neither processes nor outputs anything in the comment. Just about any
language allows this capability, for very obvious reasons. Any reason
not to let m4 discard comments?
Alternatively, m4 behavior could be changed to always discard the
comment. I can't imagine wanting to send commented text to the output,
so the current behavior seems weird to me. I'm interested to learn the
rationale. What might be the usefulness of sending commented text to the
output? Anyway, a command line option seems good enough.
I tried m4_divert(-1) as a work-around. Although it discards the output,
it still processes the commands, so it fails to provide the needed
functionality. At least half the time when I need to comment a section,
m4_divert(-1) fails because it still processes the text, causing an
error. And m4_divert(-1) seems obviously a kludge as a comment mechanism.
I also use m4_dnl as a work-around. But this only works a line at a
time, blends in with the surrounding text, again seems a kludge, and
looks really geeky (not at all like standard easily recognizable comment
symbols).
I think m4 would be better (more useful) if it allowed comments that
work the same way as other commonly used languages (C, Java, etc). It
seems odd this was not put in long ago.
http://www.seindal.dk/rene/gnu/visions.htm was found on a search. It
suggests this change was desired many years ago, and was even added as
--discard-comments at one point (and I guess removed for some reason).
I have no idea how difficult (or easy) the change would be, but to me it
seems pretty useful.
Thanks,
Daniel
- Suggestion to let m4 discard comments Daniel Goldman
-