Closed Divide-By-0 closed 11 months ago
Hi, thanks for your comment.
Although we understand the point of your comment, it would be unconventional and counterintuitive to allow using a signal outside its syntactic scope (using some form dynamic scoping as, by instantiation, the conditional is removed), since we are applying static scoping in the rest of the language.
We have clarified this point in the documentation https://github.com/iden3/circom/blob/master/mkdocs/docs/circom-language/scoping.md.
Signals are only visible in the block they are defined and they can be defined in an inner block if it is below if
statements with known conditions at compile time.
Best,
Albert
If I have code like,
Then the compiler fails with something like this:
Expected behavior would be to automatically recognize at compile time that that signal has been defined previously in an also defined if block. A pattern like above would be hard to represent without repeated code, unless we have this bugfix!