You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'll have to check, I believe the assumption right now is that variables
used inside nested functions are declared first. This should be possible
to change, but I'm really hoping we don't allow this with variables of
inferred type...
Personally, I think imposing the restriction that such variables are declared first is fine. Maybe there are other opinions. The type checker is already complex enough, so let's simplify where possible.
Okay. I'm fine with this. The current way the checker works is the following: when a statement sequence is checked, all the function declarations are found in the statement sequence and they are registered in the environment, without descending into their bodies. Then, each statement is processed in turn. When the function is reached, the body will also be checked. Nothing is done to specially handle variable declarations, so these just occur wherever they are encountered. I personally like this better, but we could modify the code to also add the variable names into the scope at the start, before processing the statements. If we decided to leave it as it is we should close the issue.
The following code is currently correct but is not accepted by the type checker.
Can this be fixed in the type checker?
gives
The text was updated successfully, but these errors were encountered: