[swift-evolution] Pitch: Partial Implementations

Charles Srstka cocoadev at charlessoft.com
Thu Mar 23 14:04:14 CDT 2017


> On Mar 23, 2017, at 1:21 PM, Matthew Johnson <matthew at anandabits.com> wrote:
> 
> If we wanted to allow code like this to be written we wouldn’t need a new keyword to do it.  You are proposing two things here:
> 
> 1) Allow stored properties in same-module extensions.  This has been discussed in the past and is a possibility, but I suspect it is not in scope for consideration during Swift 4.
> 2) Change the meaning of `private` to not mean lexical scope anymore, but instead be lexical scope or an extension of the type introducing the lexical scope in the same module.  Changes to access control other than the proposal currently under review are out of scope for Swift 4.

Neither, actually:

1) I’m proposing we no longer encourage extensions at all for this purpose. My proposal is simply to allow breaking up declarations into parts, instead.

2) I’m not proposing changing the meaning of ‘private’ here. Since partial implementations would all glom into one lexical scope, all the current access control rules would apply as they currently do. This is simply a way to write a class or struct declaration in multiple parts, without having to use extensions.

Charles

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170323/bc61a5b2/attachment.html>


More information about the swift-evolution mailing list