[swift-evolution] [Review] SE-0025 Scoped Access Level

Joe Groff jgroff at apple.com
Sun Feb 28 12:17:47 CST 2016


Nate Cook via swift-evolution
<swift-evolution at swift.org> wrote:

> For another example, see this comment in the standard library, which says
> not to use the _variantStorage property, then scroll down about twenty >
> lines to see it used:
> 	https://github.com/apple/swift/blob/master/stdlib/public/core/HashedCollections.swift.gyb#L432
> 
> As a reader of this file, what should be my interpretation here? (a) The
> init that uses _variantStorage just got put in the wrong place, (b) the
> init should've been written without using _variantStorage, or (c) the
> comment is outdated? Marking _variantStorage as scoped and closing the
> initial declaration block of the type would both communicate and enforce the actual intent.

The standard library can't take advantage of private access control yet
because of the way its implementation is fully serialized and exposed to
every program. It's not a great example of how access control ought to be
used. 

-Joe 






More information about the swift-evolution mailing list