Open scabug opened 11 years ago
Imported From: https://issues.scala-lang.org/browse/SI-6794?orig=1 Reporter: @paulp See #1352, #5114, #1409, #1415, #1469, #1800, #1915, #2568, #4316, #4323, #4400, #4549, #4626, #4739, #4962, #5000, #6165, #6213, #6232, #6437, #6617, #6760, #6880, #4845, #5508, #6245, #1994, #3144, #3167, #3276, #3946, #4218, #5134, #5217, #5251, #5565, #5665, #6216, #6309, #6585, #6733, #6793, #6003, #5008, #3197, #4548, #2840 Blocks #1994
@retronym said: That's some thorough linkin'!
@paulp said: It's a lot less than I could have done. I mostly left out some strongly related subjects like name mangling (much of the complexity of which arises from the access scheme), super/trait/protected accessors, etc. But this much should offer a taste.
Mike Slinn (mslinn) said: Will this issue be resolved for 2.11 release?
@retronym said: This is a meta-bug, it isn't going to be solved in one hit. The change in 'fix-by' version was part of a bulk change.
Mike Slinn (mslinn) said: Jason, not sure what the conclusion is. The bug is currently unassigned. Will there be any improvement in the area described by this bug report for 2.11? ... Thanks!
@retronym said: Mike: we are wrapping up 2.11 and don't plan to make changes related to access at this late stage in the cycle.
Mike Slinn (mslinn) said: That is unfortunate. I am ready to rerecord a lecture for http://scalacourses.com which discusses this visibility. Earlier versions of the lecture referenced 2.11M5 as being the point at which access visibility would achieve greater clarity, then 2.11M7. Instead, I will have to continue to say that this remains poorly defined and recommend that the undefined modifiers should be avoided.
Might it still be possible to enhance the documentation to state which modifiers that actually work as per spec, and inform the reader that the other possibilities are undefined? Here are the 8 possibilities I am referring to: protected, protected[packageName], protected[className], protected[this], private, private[packageName], private[className] and private[this].
Not 100% sure whether we have this one already:
scala> object outer {
| object foo {
| trait A { private[foo] def a = println("a") }
| }
| object bar {
| trait B extends foo.A { override def a = println("b") }
| }
| }
object outer
Edit: Hard to believe but it just wasn't linked #11339
If someone adds a question mark to the ticket title, then it can be closed by answering, "No."
I've tried for years to obtain some clarity here. It is a large tax on users and compiler developers alike that even if people knew and understood what is supposed to work and how it's supposed to work with respect to the 16 permutations of qualified/object private/protected type/value visibility/access - which they don't, myself included - that knowledge would be of limited use because there are so many bugs.
The bugs persist in large part because I lack sufficient information to fix them. It would be wonderful if we could make some forward progress on this somehow. This is a small sample of the set of behaviors which are hard to explain or defend (although I admit to the possibility that all of this is "as specified" since as I said, I am incapable of deriving the intended behavior from the specification.)