Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upInfer private[this] #7411
Conversation
This comment has been minimized.
This comment has been minimized.
test performance please |
This comment has been minimized.
This comment has been minimized.
dotty-bot
commented
Oct 13, 2019
performance test scheduled: 1 job(s) in queue, 0 running. |
This comment has been minimized.
This comment has been minimized.
dotty-bot
commented
Oct 13, 2019
Performance test finished successfully: Visit http://dotty-bench.epfl.ch/7411/ to see the changes. Benchmarks is based on merging with master (0f7a85b) |
This comment has been minimized.
This comment has been minimized.
pshirshov
commented
Oct 13, 2019
•
While I welcome removal of this syntax, I don't thin that the semantic is unneccessary. It's very convenient to be able to enforce stricter rules. Also I wouldn't call To be quiet honest I think we need lot more flexible access restriction system, so we may specifiy complex predicates on who may and may not access an entity. Could you consider keeping the functionality under different syntax please?.. Maybe not a modifer but an annotation?.. |
This comment has been minimized.
This comment has been minimized.
That's just a cop out. Seriously, I have not seen a convincing argument why distinctions between private/protected and private/protected[this] are necessary. And unnecessary distinctions just lead to bikeshedding and complexity. One could argue that the default is wrong and it should always be [this]. We already had this discussion, and I believe that the reasons for keeping plain private and protected were convincing, for algorithmic reasons as well as backwards compatibility. |
This comment has been minimized.
This comment has been minimized.
neko-kai
commented
Oct 31, 2019
•
@odersky trait ProtectedThisVarianceOk[-A, +B] {
protected[this] type AliasA = A
protected[this] type AliasB = B
}
trait ProtectedVarianceIsNotOk[-A, +B] {
// Error:(16, 18) contravariant type A occurs in invariant position in type A of type AliasA
// protected type AliasA = A
protected type AliasA = A
protected type AliasB = B
} Scala 2 allows declaration of IMHO removing |
This comment has been minimized.
This comment has been minimized.
Treating |
This comment has been minimized.
This comment has been minimized.
neko-kai
commented
Nov 3, 2019
Sorry, I was not aware. It still feels like a bad blow for cake & PDT; possibly less dramatic if variant aliases are out of the picture anyway... Removal of private[this] is of course strictly an improvement (if someone needs a not-this |
This comment has been minimized.
This comment has been minimized.
ryanberckmans
commented
Nov 23, 2019
Here is a proposal to retain |
odersky commentedOct 12, 2019
•
edited
Infer private[this] if all accesses are via this, even if it is not explicitly specified.
Deprecate usage of
private[this]
andprotected[this]
under -strict (i.e. for 3.1.).The main reasons for dropping
private[this]
are:this
is a value.private
is purely local and can be easily inferredprivate
orprivate[this]
? One is shorter but the other might be more efficient.protected[this]
by now influences compiler decisions in no way at all. Its delta overprotected
is small.protected
by itself is niche (e.g. Don Syme has argued eloquently why it is too niche for F#), so having two variants of it looks like overkill.