Welcome to the 89th issue of Swift Weekly Brief! This week was more calm, no news explosions. The repositories and mailing lists had their usual activity.
有兴趣赞助 Swift Weekly Brief?点击这里
Starter tasks
Starter tasks are a great way to get started with contributing to Swift. Ask questions directly in the bug reporting system, and get feedback when you submit your pull request.
- SR-5996: Improve compiler error with a fix-it: Cannot assign to value,
bar
is alet
constant - SR-5995:
update-checkout --tags
should fetch –tags before attempting to find a tag - SR-5983: Unused result warning phrasing is worse for closures than normal functions
- SR-5982:
didSet
causes unwanted calls to getter even whenoldValue
isn’t used
Submit a task by sending a pull request or opening an issue.
Swift Unwrapped
In Episode 30 Jesse and JP welcome Mike Ash to discuss weak references and the implementation changes that shipped in Swift 4.
News and community
There’s a (relatively) new addition to the Swift docs collection: Standard Library Programmers Manual, written by Michael Ilseman. Thank Ole for discovering this and sharing!
This week was Clang’s 10th anniversary! 🎉 🎊
Mike Ash wrote a great Friday Q&A about the changes in Swift’s weak references implementation. (This is the post he discussed on Swift Unwrapped.)
Weak references are an important language feature. Swift’s original implementation was wonderfully clever and had some nice properties, but also had some problems. By adding an optional side table, Swift’s engineers were able to solve those problems while keeping the nice, clever properties of the original. The side table implementation also opens up a lot of possibilities for great new features in the future.
Ahmed Sulaiman wrote a descriptive blog post: Debugging Swift code with LLDB about using lldb in general and some unpopular tricks with Swift debugging. Take this chance to enhance your debugging skills!
Russ Bishop shared the problem behind the Xcode 9 simulator’s very slow performance — surprising bug!
Commits and pull requests
Doug Gregor opened a pull requests that implements the standard library part of SE-0157: Recursive Protocol Constraints.
Joe Groff fixed a compiler crash in the case where code captured [weak self] in a closure inside a class method returning dynamic Self
.
Jordan Rose merged a pull request for a Swift compiler crash fix where Swift didn’t handle cases of Objective-C inheritance from a typedef
for a class/protocol composition as shorthand for inheriting from the class and adopting the protocol.
Philippe Hausler merged great improvements to Data slices. This change fixes SR-5887, SR-5873 and SR-5810.
Doug Gregor merged a pull request for caching name lookup for nested types of generic types through the equivalence class.
Saleem Abdulrasool merged changes to allow building the stdlib on Windows ARM.
Slava Pestov merged a preliminary implementation of a code completion fuzzer. And guess what, it’s written in Swift! 😎
Kacper Harasim implemented a new refactoring action to convert do
/catch
statements to try!
. (SR-5743)
Michael Ilseman opened a pull request with a prototype implementation for new String comparison.
Kacper Harasim merged a pull request with improvements to the local refactoring library.
Proposals
No updates on proposals this week. As always, you can check out the Swift Evolution status page for all the details.
Mailing lists
Ben Cohen revived a pitch to add a remove(where:)
function to the Standard Library. You can check out a proposal draft and join the discussion.
It is common to want to remove all occurrences of a certain element from a collection. This proposal is to add two in-place
remove
algorithms to the standard library, which will remove all entries in a collection in-place matching either anEquatable
value, or match that a certain criteria.
Finally
Finally — tl;dr slicing a CoW should result in fillet mignon not ground chuck.