[swift-evolution] Swift evolution proposal: introduce typeprivate access control level

Tino Heth 2th at gmx.de
Thu Dec 1 07:34:01 CST 2016

> @Tino: Regarding the following statement - "Even if there was a change of mind, fileprivate is still needed for essential things like implementing Equatable.”
> How exactly is that so? Am I missing something?

class Eq: Equatable {
	private var value = 0

func ==(lhs: Eq, rhs: Eq) -> Bool {
	return lhs.value == rhs.value

This doesn't compile — but it works fine when you declare value to be fileprivate.
There are other cases where fileprivate is the best choice, but this is quite common (of course, it's always possible to use internal instead… but we could as well remove all levels and keep nothing but public)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161201/01c20afc/attachment.html>

More information about the swift-evolution mailing list