Allow macro expansion on default macro value

0 votes
asked Jan 4 in Wanted features by hukameniz (900 points)
edited Jan 6 by hukameniz

When using default macro arguments, we must add the value in comma ("" or '') this means that we can't use a macro as the default value.

For example, this gives a syntax error:

!define FOO myclass

!define BAR(name = FOO) class name

This also won't work: 

!define FOO "myclass"

!define BAR(name = FOO) class name

Actually I think that the proper way to handle it would be to add  the string as is and then check if the resulting string has any macro, if yes, then expand those, if the resulting string still contains macros, then expand those, and keep doing it until there's no more expansions.

So, this example:

!define ABC "myclass"

!define FOO ABC as ABC

!define BAR(name = "FOO") class name

BAR

Would result in: class "myclass" as "myclass"

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...