The scope for a top-level declaration is the file itself.  This means that 
top-level declarations with `private` and `fileprivate` should have the same 
behavior.  They should not be uninstantiable or unusable.

-Matthew

> On Jun 15, 2016, at 1:31 PM, Robert Widmann via swift-evolution 
> <[email protected]> wrote:
> 
> While implementing SE-0025 (fileprivate), I noticed an interesting bug in the 
> proposal.  Under the implementation outlined there, any top-level structure, 
> class, or enum declared private cannot possibly be instantiated and so cannot 
> be used in any way.  Because of this, private top-level declarations are more 
> often than not blown away entirely by the compiler for being unused.  It 
> seems strange to me to allow a key language feature to act solely as a hint 
> to the optimizer to reduce the size of your binary.  Perhaps the restrictions 
> around private needs to be relaxed or the line between fileprivate and 
> private needs to be investigated again by the community before inclusion in 
> the language.
> 
> Thoughts?
> 
> ~Robert Widmann
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to