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

Ilya Belenkiy ilya.belenkiy at gmail.com
Fri Feb 26 20:08:05 CST 2016

The question is not whether it's in the same file but whether it should
have access to internal state (and potentially mutate it). If it shouldn't,
the compiler should enforce it no matter which file you are in. This is not
possible right now. A similar argument could be made about var and let. If
you are careful, then you can just have var (and put a comment that the
value is not supposed to change). Everybody likes let because it's enforced
by the compiler. The same applies to scoped. If you don't have any
implementation details that you want to hide, you will not benefit from
scoped. But if you do, the compiler will enforce it much better than any
convention or comments.
On Fri, Feb 26, 2016 at 8:53 PM Joseph Lord <joseph at human-friendly.com>

> The key differences are:
> 1) You are already the file implementing on that area of code if you are
> in the same file.
> 2) The file shouldn't be that big whereas the module is likely to have
> hundreds of files and several people on it.
> 3) There are performance benefits to be had with private (at least when
> Whole Module Optimisation is off).
> I'm not too worried if it does get included it just seems the gains will
> be quite small. Can you point me to some code that would really benefit or
> where the lack of it has caused mistakes or problems in the past?
> Joseph
> On Feb 27, 2016, at 1:24 AM, Ilya Belenkiy <ilya.belenkiy at gmail.com>
> wrote:
> By the same logic, the comment alone is enough, the private keyword isn't
> necessary. The benefit of scoped is that the intent would be enforceable by
> the compiler.
> On Fri, Feb 26, 2016 at 6:48 PM Joseph Lord via swift-evolution <
> swift-evolution at swift.org> wrote:
>> On Feb 26, 2016, at 7:05 PM, Douglas Gregor via swift-evolution <
>> swift-evolution at swift.org> wrote:
>> The review of SE-0025 “Scoped Access Level" begins now and runs through
>> March 3, 2016. The proposal is available here:
>> https://github.com/apple/swift-evolution/blob/master/proposals/0025-scoped-access-level.md
>> -0.1
>> There is nothing wrong with this proposal but I just don't see the value
>> over private (plus a little doc comment if absolutely necessary).
>> Downside is more language to learn / encounter and complexity to
>> maintain.
>> I've read the proposal but not the preceding discussion.
>> Joseph
>> _______________________________________________
>> 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/20160227/ded6aacc/attachment.html>

More information about the swift-evolution mailing list