Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Prohibiting private references outside of classes #49

Closed
bakkot opened this issue Sep 12, 2016 · 3 comments
Closed

Prohibiting private references outside of classes #49

bakkot opened this issue Sep 12, 2016 · 3 comments

Comments

@bakkot
Copy link
Contributor

bakkot commented Sep 12, 2016

In my ideal world, it would be an early error to refer to a private field which is not lexically in scope: e.g. it would be an early error to write class C { m(){ #a; } } at the top of a module. However, class { m(){ #a; } #a; } should remain legal, so this might be difficult (because we don't know if a field is in scope until later).

But I think we could at least ban private field references which occur outside of any class body, which is something we know at the time that we see the reference. Depending on how this is done, this could also have the effect of preventing access to fields from within eval.

@zenparsing
Copy link
Member

I would like that as well. My next step (before @littledan took over) was to start writing the early error rules.

@littledan
Copy link
Member

PRs still accepted! I wrote out the ones in your TODOs, but I'm happy to see @bakkot filing bugs on ones that are still missing. @zenparsing , were there any more things on your mind for important early errors? I'd like to fix the remaining ones in the next couple weeks.

@littledan
Copy link
Member

Fixed by f021d93

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants