Skip to content

Add draft proposal for ownership keyword removal in protocols. #707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 20, 2017

Conversation

gspiers
Copy link
Contributor

@gspiers gspiers commented May 9, 2017

This proposal removes support for the keywords weak and unowned for property declarations in a protocol.

This would fix SR-479.

There's was discussion on the Swift-evolution thread: Ownership on protocol property requirements. Most comments were that weak and owned for a property in a protocol don't have any meaning currently, are misleading to users, and should be removed.

Although no functionality is actually being removed or changed it is technically a source breaking change.

There were comments around introducing meaning to these keywords in protocols but that it would probably be better given time constraints to get this inconsistency fixed for Swift 4 and bring up adding meaning as a separate topic.

Update, I've added a pull request for the implementation of this proposal apple/swift#11744.

@DevAndArtist
Copy link
Contributor

This proposal should not **effect** API resilience. Typo?

@gspiers
Copy link
Contributor Author

gspiers commented May 9, 2017

@DevAndArtist Thanks, fixed 👍

@tkremenek tkremenek self-assigned this Aug 9, 2017
@tkremenek tkremenek added the workgroup: needs implementation This proposal needs more implementation work before it can be reviewed label Aug 9, 2017
@tkremenek
Copy link
Member

The Core Team briefly discussed this proposal and believe it has a lot of traction. An implementation is needed for this proposal to schedule it for active review. Since this is source-breaking, a desired implementation would warn in the existing Swift modes (with a fixit to remove weak and unowned) and an error (with fixit) in Swift 5 mode.

@tkremenek tkremenek removed their assignment Aug 9, 2017
@tkremenek
Copy link
Member

Please assign this back to me when there is an implementation.

@gspiers
Copy link
Contributor Author

gspiers commented Aug 9, 2017

Thanks @tkremenek! I've got the start of an implementation.

I originally added the change with fixits for warning in Swift 3 mode, and an error in Swift 4. I've rebased and will look at changing that to warn for Swift 4 mode and error in Swift 5 as you suggest.

As this might be my first contribution I'll open a PR on the Swift repo as I might need a bit of help and guidance along the way. When I've got it ready I'll update this proposal with the link. Thanks again.

@lattner
Copy link
Collaborator

lattner commented Aug 9, 2017

Fantastic, please ask on the swift-dev mailing list if you get stuck and need help.

@gspiers
Copy link
Contributor Author

gspiers commented Sep 2, 2017

I've added a pull request for the implementation of this proposal apple/swift#11744.

@tkremenek I don't have permission to set the assignees but it's ready if you want to assign yourself back to it. Thanks.

@tkremenek tkremenek self-assigned this Sep 2, 2017
@tkremenek tkremenek added workgroup: ready This proposal seems to be ready for evolution review and removed workgroup: needs implementation This proposal needs more implementation work before it can be reviewed labels Sep 2, 2017
@tkremenek
Copy link
Member

Implementation looks like it is coming along nicely. I've noticed some comments from @jrose-apple and @slavapestov in the implementation as it looks like they are actively reviewing the implementation.

@tkremenek
Copy link
Member

This is ready for review.

@tkremenek tkremenek merged commit 8ab5668 into swiftlang:master Sep 20, 2017
ApolloZhu referenced this pull request in future-application-laboratory/BirthReminder Dec 26, 2017
### Fixed
- Fixed memory leak relating to capturing CFNotify
- Fixed black screen after search
### Added
- Introduced `ManagedObjectContextUsing` protocol with default
`context` implemented in `AppDelegate`
### Changed
- Made `context` static in `AppDelegate`
- Removed some unnecessary force unwrapping
### Suggested
- Integrate imported characters’ `id`s to `uuid`s in core data to avoid
duplicate?
- Report the black screen as a bug to apple?
- Remove unused `ManagedObjectContextSettable` protocol?
- Upgrade `InAppNotify` to use Swift 4 instead of 3.2?
uetcis added a commit to future-application-laboratory/BirthReminder that referenced this pull request Dec 29, 2017
uetcis added a commit to future-application-laboratory/BirthReminder that referenced this pull request Dec 29, 2017
ghost pushed a commit to ustwo/formvalidator-swift that referenced this pull request Apr 3, 2018
ghost pushed a commit to ustwo/formvalidator-swift that referenced this pull request Apr 4, 2018
commit 75f4a15
Author: Aaron McTavish <[email protected]>
Date:   Tue Apr 3 09:17:19 2018 +0100

    Weak is no longer allowed on protocol properties

    See Swift Evolution: swiftlang/swift-evolution#707

commit 31a0279
Author: Aaron McTavish <[email protected]>
Date:   Tue Apr 3 08:51:02 2018 +0100

    Update to Xcode 9.3 Project Settings

commit faa9ef1
Author: Aaron McTavish <[email protected]>
Date:   Tue Apr 3 08:48:42 2018 +0100

    Update gem dependencies
ghost pushed a commit to ustwo/formvalidator-swift that referenced this pull request Apr 4, 2018
* Update gem dependencies

* Update to Xcode 9.3 Project Settings

* Weak is no longer allowed on protocol properties

See Swift Evolution: swiftlang/swift-evolution#707
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workgroup: ready This proposal seems to be ready for evolution review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants