Skip to content
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

LOCAL, isLocal, and private[this] #6733

Closed
scabug opened this issue Nov 28, 2012 · 3 comments
Closed

LOCAL, isLocal, and private[this] #6733

scabug opened this issue Nov 28, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Nov 28, 2012

The reflection API seems to provide no easy way to check for a symbol being private[this]. The only way I could find to do it is to explicitly check for hasFlag(LOCAL). It seems too important and fundamental to require direct access to flags like this.

Meanwhile, there is a method called isLocal that sounds like it is supposed to check for private[this]. The API doc for this method talks about access being limited to the enclosing object. That's not what the method actually returns, however. What the method returns is whether the symbol is defined within a term, as opposed to within a class.

It looks like the API method has had an accidental collision with a method that already exists in the Scala compiler. In my opinion, the definition in the compiler is a better match for the name "isLocal". Thus, add a new method to check for private[this], perhaps named isPrivateThis.

@scabug
Copy link
Author

scabug commented Nov 28, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6733?orig=1
Reporter: Lex Spoon (lexspoon)

@scabug
Copy link
Author

scabug commented Nov 28, 2012

@paulp said:
There is such a method (only on the compiler side) called isPrivateLocal; to be consistent with the specification, the name should maybe be isObjectPrivate. Although I tend to wish for things to be called the same thing they're called, so isPrivateThis is more appealing if the naming is done consistently.

@scabug
Copy link
Author

scabug commented Feb 1, 2014

@xeno-by said:
scala/scala#3452

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

No branches or pull requests

2 participants