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

Xiaodi Wu xiaodi.wu at gmail.com
Fri Mar 24 23:05:06 CDT 2017


On Fri, Mar 24, 2017 at 10:57 PM, Jonathan Hull via swift-evolution <
swift-evolution at swift.org> wrote:

>
> On Mar 24, 2017, at 8:38 PM, Drew Crawford <drew at sealedabstract.com>
> wrote:
>
> On March 24, 2017 at 10:21:17 PM, Jonathan Hull (jhull at gbis.com) wrote:
>
> This is exactly the problem. Both for access controls and dispatch.
>
>
> How would you respond to clattner's position piece
> <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/001948.html> on
> this?  He disputes this point directly:
>
>
> Swift is another case of a hybrid model: its semantics provide
> predictability between obviously static (structs, enums, and global funcs)
> and obviously dynamic (classes, protocols, and closures) constructs.  A
> focus of Swift (like Java and Javascript) is to provide an apparently
> simple programming model.  However, Swift also intentionally "cheats" in
> its global design by mixing in a few tricks to make the dynamic parts of
> the language optimizable by a static compiler in many common cases...
> The upshot of this is that Swift isn’t squarely in either of the static or
> dynamic camps: it aims to provide a very predictable performance model
> (someone writing a bootloader or firmware can stick to using Swift structs
> and have a simple guarantee of no dynamic overhead or runtime dependence)
> while also providing an expressive and clean high level programming model -
> simplifying learning and the common case where programmers don’t care to
> count cycles.
>
>
> I agree with him.  I think you must be missing my point.
>
> Is it?  Can you point to an instance where a member of the core team said
> they are aiming for “plenty of overlap”?
>
> See above
>
> I don’t see where you are reading this from what he said.
>

In fact, I read Chris's position piece as pretty clearly rejecting the
"plenty of overlap" claim. An overlap would involve two or more things that
have at least partly redundant function. Chris talks of a hybrid model:
i.e., one thing, not two or more, melded from disparate parts in such a way
that there is no overlap. His whole text is justifying the particular
hybrid chosen. Offering both static and dynamic as two separate models is
out of the question; the debate at hand is not _whether_ there should be
one or two models in Swift, but _how_ two are to be combined into one.


> Honestly, most of your examples could just be split into multiple files.
>
> Specific arguments were advanced in those examples that they cannot.  Can
> you refute them?
>
> Honestly those felt like ill-advised hacks to me (especially shadowing in
> the same file).  As Xiaodi suggested earlier, you could use a linter if you
> really wanted to enforce them.  I personally use an underscore before
> variables I don’t want to expose outside the type.
>
> I would be interested to know about other use-cases you have, because it
> may be possible to design for them in a way which does not require scoped
> private.
>
>
> You are conflating effort by the swift design and implementation community
> with your personal effort around migration.
>
> No, I am referencing a Swift at IBM developer who reported that
>
> the open-source version of Foundation still has a long way to go to get
> the level of quality of the existing Objective-C frameworks, and we already
> have enough work to do without having to go make a bunch of arbitrary
> changes and risk a bunch of regressions because someone doesn't like a
> keyword... Accepting this proposal would waste hundreds of person-hours of
> work…
>
> Yes you are.  You can make a separate argument that migration will be an
> issue. (and if you recall my own vote was to wait on the implementation and
> make all of the changes at once in Swift 5).
>
> I am asking about the time of the Swift team and surrounding
> design/implementation community.  Do you honestly think that supporting
> both scope and file-based access control is important enough that we should
> spend the time/effort to fix the current issues in another way that allows
> both?
>
> Thanks,
> Jon
>
>
>
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170324/d995e035/attachment.html>


More information about the swift-evolution mailing list