[swift-evolution] [swift-evolution-announce] [Review] SE-0159: Fix Private Access Levels

Zach Waldowski zach at waldowski.me
Tue Mar 21 19:45:15 CDT 2017


On Tue, Mar 21, 2017, at 07:44 PM, Drew Crawford via swift-evolution wrote:
>> When new `private` and `fileprivate` were shipped, there were
>> numerous questions asked by users on forums such as Stack Overflow
> 

> And before they were shipped, there were people asking for a scoped
> modifier.  And when we change them again, what questions will that
> generate?  So I don’t see what we are accomplishing with this line of
> inquiry.
> 

>> You see the new access modifiers described, for example, as something
>> that "take[s] some getting used to." Rather damning as a euphemism,
>> don't you think?
> Not at all.  We could describe strong typing, or optionals, enums,
> pattern matching, etc., in this way.  ARC in particular is “difficult
> to teach” but we should not get rid of it, it solves a safety problem.
> A scoped access modifier is similar.


These two points are where I have to jump in. As someone who actually
teaches Swift, and not just lectures others about it on the mailing
lists, both of these arguments are terribly fallacious. Core Swift
features like optionals are fundamental to the idea of the language,
that have semantic meaning and impact on  compiled code.


People are thrilled to learn how to use enums because they make for a
better time writing code. These access modifier are can only charitably
be called code flavor. I have spent entire weeks of class trying to
extoll the benefits, so breathlessly shared on these mailing lists, of
how beautiful it is to have a scoped access level. I have yet to
succeed. They frustrate readers and they are a constant source of
roadblocks for the inexperienced.


Segregating private and fileprivate are, at best, a distraction, and at
worst are actively imposing on all of us the personal code style
preferences of those that were most active on the mailing lists while
Swift 2 was open.


It doesn't matter if desire for using extensions is the root of the
problem. Swift should only impose a preference when it's important to
the speed, functionality, and safety of the language. I have yet to be
convinced that there's a benefit to a scoped access level that fits
anywhere in there.


Best,

  Zach Waldowski

  zach at waldowski.me




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170321/094bf5cd/attachment-0001.html>


More information about the swift-evolution mailing list