KarolS / KarolS/millfork

Macro Variable Declaration

Open
#77 2 comments 0 reactions 0 assignees View on GitHub
compiler enhancement question
Dominant language
Scala
Stars
279
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Millfork does not support declaring new variables inside of macros. What is the reasoning behind that? Are there non-trivial issues with collisions that don't occur in "normal" scopes (I'm assuming the primary concern is the variable scope extending beyond the macro)?

Regardless of the answer here, can we get errors on variable declaration within macros? I have hit several scenarios where I forgot about variable declarations when converting a function to a macro, and using the newly declared variable results in the opaque error ```Exception in thread "main" millfork.env.UndefinedIdentifierException: Variable `variable` is not defined```, which doesn't give a clear indication of where the usage exists.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.