Bug: pre-processor not respecting for loop scope

This is not a critical bug, but fixing it would help prevent people (e.g. me) shooting themselves in the foot.

If you have a pre-processor loop, for example:

@#for lead in 1:offset
      LEAD@{lead}_FrakturIPart(0) = LEAD@{lead-1}_FrakturIPart(+1);

Then upon hitting the @#endfor statement, the pre-processor variable lead should ceased to be defined.

When copying and pasting code around it’s very easy to accidentally end up with loop local variables that shouldn’t be there. Throwing an error in this circumstance would be a great help.



This is not really a bug but a characteristic of the macro-language. This behavior is normal because all the macro-variables have global scope. There is no concept of local scope in the macro-language. Maybe we should make that more explicit in the documentation. And changing this behavior wouldn’t be easy. for implementation and backward compatibility reasons.