Can we give a better error for out-of-scope identifiers?
Had I known the scoping rules, I would have known that this won't work:
${if true
${define FUNC wobble}
} else {
${define FUNC wibble}
}}
And that instead I need to say this:
${define FUNC ${if true {wobble} else {wibble}}}
But the error message was a simple "user-defined expansion not found", which confused me for a while.
I see a few possible ways around this.
- Perhaps, give a warning if a
${define}
is unused, or is never in scope. - When giving a error about an expansion or condition that isn't found, note if it is declared elsewhere in the macro, but is out of scope where it is used.
- When we get around to documenting
${define}
in the introduction, make sure to explain this gotcha.