[swift-evolution] final + lazy + fileprivate modifiers

Tino Heth 2th at gmx.de
Wed Feb 15 05:13:18 CST 2017


> 1) private to the file (Swift 2 semantics)
> 2) accessible only to the current type/scope and to extensions to that type that are in the current file.

Imho the old model had the benefit that it made things like C++ "friend" superfluous, so I prefer 1) over 2).
It is simpler, and from a pragmatic standpoint, it is much more useful:
You can always put code into another file if you don't want it to access private stuff.

2) Solves the problem of encapsulation for playgrounds, but that could be done in other ways — there could be an #eof statement for playgrounds, and maybe Swift will even have improved namespaces in the future...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170215/e5013610/attachment.html>


More information about the swift-evolution mailing list