-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shouldn't this re-binding be an error? #1707
Comments
Typically we haven't reported binding errors for shadowing across namespaces. Pyret has three – values, types, and modules (and arguably datatypes but that's basically just types). So you can bind all of:
It actually used to be the case that the |
@blerner do we want to spec this as an error? I could go either way. It's not technically backwards compatible with code written since module system updates.... but also I can't see it biting many people, and I could see the argument that modules regressed this behavior. |
I'm torn. I don't see any internally consistent middle ground between having three namespaces or having only one: if module imports ought to conflict with both type and value definitions... then shouldn't types and values collide? I'm fine keeping it as three separate namespaces, it seems more internally consistent to me. |
If I write
I get a name binding conflict error.
However, if I write
there is no error, and
S
is bound to 2. Indeed, in this programonly the two
S =
lines produce an error.I feel like once
S
is bound byimport
, re-binding it should produce an error?(I was tripped up by it because a student asked a question about
import
and I initially wrote "Pyret will make sure thatS
is not bound to anything else, andS.foo
will …", and then checked and found that that's not actually true. It seems like a thing we would want to be able to say?)The text was updated successfully, but these errors were encountered: