[swift-evolution] Enhancing access levels without breaking changes
david at hartbit.com
Mon Apr 10 02:20:01 CDT 2017
> On 10 Apr 2017, at 08:21, Jean-Daniel <mailing at xenonium.com> wrote:
>> Le 10 avr. 2017 à 07:15, David Hart via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> a écrit :
>> On 10 Apr 2017, at 05:08, Jose Cheyo Jimenez via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>>> On Apr 9, 2017, at 7:14 PM, Jonathan Hull via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>>> This struck me as a bit odd at first, but the more I think about it, the more I really like the ability to nest extensions/scopes. The one issue I see is sticking that public extension inside a private one. I think you would have to mark ‘secret: Int’ as private instead of the extension itself to allow the effect you are looking for...
>>>> What I ultimately want is the ability to declare storage in extensions in the same submodule. Combining that with fileprivate will allow the same tricks without the indentation (together in their own file). This nesting will help in the mean-time (and would still be useful after for those who prefer to organize their code in fewer/longer files). I think it could be helpful in other ways too…
>>> What do you think of `partial` types like C# but limited to a file?
>>> https://msdn.microsoft.com/en-us/library/wbx7zzdd.aspx <https://msdn.microsoft.com/en-us/library/wbx7zzdd.aspx>
>>> https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170403/035360.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170403/035360.html>
>> That's the direction the new proposal (0169) is going towards with extensions in the same file.
> I don’t see how SE-0169 do that more than any other meaning private got until now. This was already the case with the initial meaning of private, and was the case with fileprivate.
The current semantics of private don’t give any support for partial types like in C# because the accessibility is restricted to the current scope. With SE-0169’s private, extensions in the same file as the type share that scope. Plus, the Alternatives Considered section of the proposal discusses potential future directions where those extensions could look even more like C# partials :)
> And for file splitting and visibility control, we need submodules. Until then, if this proposal is to define the ultimate meaning of private, I rather like this meaning that the SE-0025 one.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution