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
{{ message }}
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.
_ is traditionally used to denote an ignored argument/variable, and it frequently makes sense to have more than one:
function(_,_) return0end
So throwing
[Error] This variable will overwrite another same-named variable in the same scope
in this case is somewhat counterproductive.
I would've preferred to declare the function in question as function() return 0 end in the first place, but that opens a whole new can of worms, since neither
This turned out to be more difficult than I've originally thought. Originally I thought that this is a mere reporting issue because the type system doesn't care about the names and only the parser recognizes the "error", so I can just defer errors to see if the name is indeed used. But there is a catch: the type system has to assign types to every name even though it is never read again, so any fix to this issue can easily interfere with the type system.
In the current plan, the AST has to be able to mark some names "ignorable", which means that the name is never read (it's a fatal error if it does) and it gets exempted from the further type checking (except for the annotation itself, which should be a proper type). We do not make every unread names ignorable because we want to be notified for normal usages.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
_
is traditionally used to denote an ignored argument/variable, and it frequently makes sense to have more than one:So throwing
in this case is somewhat counterproductive.
I would've preferred to declare the function in question as
function() return 0 end
in the first place, but that opens a whole new can of worms, since neithernor
are valid types. And
is not a subtype of
either.
The text was updated successfully, but these errors were encountered: