FYI: when you are not sure you can just post your question (because this is a question) in "Coding questions" first.
You can post it again in the appropriate section once you've made your mind about it.
About your question: documentation could be more strict but a simple DO BY YOURSELF test seems to suggest a macro name has to follow the same rules used for identifiers, so no strange names like (, ~, {, etc.
See the the rules to be observed when naming a variable in the manual.
So you are out of luck in replacing those.
About your REM example, I think that outcome may be debatable:
Code: Select all
Macro DQ
"
EndMacro
Macro MYCHAR_1
$
EndMacro
Macro MYCHAR_2
;
EndMacro
a$ = DQ#MYCHAR_1#DQ
b$ = DQ#MYCHAR_2#DQ
Debug a$ ; $
Debug b$ ; empty string
By logic, the second example should work too, but it seems PB just throw away any comment when expanding a macro (so yours doesn't work too).
That is bad in this specific case (and yours), but by doing so it lets you to write comments inside a macro without affecting the macro.
For example:
Code: Select all
Macro MYCHAR_1
$; this is a dollar sign
EndMacro
still works the same
Since in a macro you can write the most absurd stuff (when it works), and what written inside a macro doesn't have to be syntactically valid (only when expanded in the final context need to make sense) I would be more inclined in not treating the comments differently and expanding them too like any other text inside the macro.
For example now we have a compiler switch which gives as output the post-processed source file with macros expanded, and one could want to output comments in specific places by using macros, maybe for textual markers to be used by a precompiler or something like that.
Also removing comments from the macro contrasts with the idea that no evaluation of the contents is done at this stage. The macro should be simply expanded and the resulting line processed by the compiler and the comments stripped only then.
May be debatable, it's possible there is something else I'm not considering right now.