Issue #117 06 Sep 2018
Written by: Greg Heo
Bikeshedding, literals, thinking raw strings;
Swift on the server is earning its wings.Numbers are multiples, even or odd;
Pull requests benchmarking faster, no fraud.September announcements are here once again;
New phones and devices, and soon Xcode 10.
September is here, and we’re closing out the Summer of Swift. We’ve almost made it through the beta period and now iOS 12, macOS Mojave, Xcode 10, and Swift 4.2 are upon us.
There’s been a flurry of activity on Swift Evolution and around the community; let’s get started with all the latest!
News and community
The LLVM Foundation announced the program for the 2018 LLVM Developers’ Meeting scheduled for October 17–18 in San Jose. Swift nerds will recognize several names on the program.
The Swift Server Work Group has a new stated goal:
The main goal of the Swift Server work group is to eventually recommend libraries and tools for server application development with Swift.
SwiftNIO is currently the sole recommended library, but you can stay on top of updates from the group in the Server category of the Swift forums.
Commits and pull requests
Doug Gregor merged in some new “Request-Evaluator” infrastructure around the type checker to help eliminate mutable state and track dependencies. See the design document and pull request for all the details.
Erik Eckstein removed the now unneeded pinning built-ins and SIL instructions. As summarized in a tweet: “Nice simplification of the Swift reference counting model - the entire concept of “pinning” is gone now, thanks to exclusivity enforcement”.
Great work by Pavol Vaskovic on spotting a recent regression causing incorrect sorting (!) from the standard library, and Kirill Chibisov for the bug fix. Test your code and watch your variable names!
Accepted proposals
SE-0200: Enhancing String Literals Delimiters to Support Raw Text was accepted. With extra delimiting characters #"like this"#
, you’ll be able to control how escaping works and have an easier time writing “raw” text.
This is one of the most well written Swift Evolution proposals in my opinion, and has an epic 461 forum posts split across three threads for your reading pleasure.
SE-0225: Adding isMultiple
to BinaryInteger
was accepted with modifications. The isMultiple(of:)
method made it in, but proposed computed properties isEven
and isOdd
were dropped.
SE-0226: Package Manager Target Based Dependency Resolution was accepted with generally positive comments all around. This change will speed up package resolution by only resolving dependencies that are actually used rather than all declared dependencies.
Returned proposals
SE-0223: Accessing an Array’s Uninitialized Buffer was returned for revision. This proposal would allow you to initialize and access arrays via raw buffer. The core team was looking for more usage experience and discussion around handling errors.
Rejected proposals
SE-0132: Rationalizing Sequence end-operation names was rejected. Although it would make sequence and collection operation naming more consistent (e.g. “first” vs “start” vs “prefix”), the core team decided the source compatibility hit would be too great.
SE-0222: Lazy CompactMap Sequence was rejected. The proposal would have added a new LazyCompactMapCollection
to represent a compactMap
to more efficiently handle chains of map
and filter
operations.
The core team decided the performance benefits were negligible and not worth the increased complexity pointed out during the review discussion.
Proposals in review
SE-0227: Identity key path is in review through Friday September 14.
Swift values already have a .self
pseudo-property to refer to the value itself, and this proposal would add a corresponding key path \.self
.
Swift Forums
Containerization has officially reached the world of Swift: Haris Amin posted about plans to offer an official Docker image for the community.
Doug Gregor wrote a pitch for Opaque result types — the ability to hide a function’s exact return type and specify its capabilities instead.
Erik Eckstein wrote an update on improvements to running benchmarks on pull requests. They are faster, less noisy, and have nicer reports — a great boost to developer productivity.
Alex Hoppen announced SwiftSyntax is now in its own repository and available to include via Swift Package Manager. SwiftSyntax is a wrapper for libSyntax and lets you write tools to work with Swift code in Swift.
Daniel Duan highlighted the approval post for SE-0225 mentioned above, where review manager John McCall listed guidelines for what gets included in the standard library:
To be considered for addition to the library, a proposed feature must satisfy two conditions: it must provide functionality that is useful to a substantial population of Swift programmers, and it must provide substantial advantages over the alternative ways of accomplishing that functionality.
Finally
Add this to the category of things I read all the time, but never had to say out loud and don’t know how to pronounce.