It was the Chinese philosopher Laozi who said 「千里之行,始於足下」, or “a journey of a thousand miles begins with a single step”. Oh wait, or was that Joe Groff who said that the journey to Swift 4 begins with a single pull request…?
In any case, with major Apple releases out of the way, the Swift repositories are buzzing with activity. This week, we cover ABI FIXME cataloging, source-breaking changes, and cross-platform developments for Android, FreeBSD, and Cygwin.
Starter tasks
- SR-2627: The Swift standard library’s
UnicodeScalar.utf16
does not have an access modifier, and is therefore consideredinternal
. It should be markedpublic
. - SR-2626:
String
toDouble
conversion fails onsnan
(signaling NaN) input. The task already has some discussion on the specifics of when exactly the converted value should signal. Some knowledge of Swift and C may be helpful in completing this task. - SR-2653: Add an option to the Swift build script to specify whether to build SourceKit. Basic knowledge of Python, shell scripting, or CMake would be helpful, but not strictly necessary.
Submit a task by sending a pull request or opening an issue.
Commits and pull requests
Many private API in libdispatch, Foundation, and XCTest are currently marked public
due to a bug in SIL linkage. This week, Chris Bailey sent a pull request to expose internal variables and methods on Operation
as a workaround. Brian Gesiak sent a pull request to mark internal variables as final
, which works around the bug in some cases.
Airspeed Velocity numbered and categorized each of the FIXMEs associated with ABI stability. Now you can tell your friends about the difficulty of resolving ABI FIXME #104, and they’ll know exactly which issue you’re referring to.
Swift and its tooling is being maintained to work on many different platforms. Han Sangjin fixed Cygwin support in llbuild. K Staring sent a pull request to fix FreeBSD support.
Several improvements have been made to Swift diagnostics’ QoI. Jordan Rose added a fix-it for when a trailing closure causes ambiguity as to which function will be called. Harlan Haskins sent a pull request to improve the error diagnostics for closures that incorrectly take a var
parameter, such as myClosure { (var foo) in ... }
.
What makes a “source-breaking” change in Swift? Sometimes it’s not clear. Slava Pestov changed variadic closure arguments to be @escaping
by default, which is technically a source breaking change, but only for invalid code. Jordan Rose sent a pull request to change all CoreFoundation types to conform to Equatable
and Hashable
by default. Jordan’s pull request is a source-breaking change, but only for code that’s manually extended a CoreFoundation type to conform to Equatable
or Hashable
. Unfortunately, some code that does just that was found on GitHub, and so his changes may be delayed until Swift 4.
Doug Gregor fixed SR-993, a bug in which static let
variables defined on Objective-C class extensions would be inferred to be both final
and dynamic
.
Erik Eckstein added new SIL instructions to support tail-allocated arrays in SIL. Maybe as a result we’ll see some improved benchmarks for appending objects to an array?
Graydon Hoare added a -swift-version <n>
option. This would allow you to use a the Swift compiler released as “Swift 3.1”, but pass the option -swift-version 2.2.1
to force it to compile code as Swift 2.2.1. Of course, there’s no guarantee that a modern Swift compiler could correctly compile Swift 2.2.1 code, but the option to force it to do so is handy.
Three weeks ago Daniel Dunbar added a new dependency resolver to SwiftPM. This week Ankit Aggarwal added support for the update
command. You can try it out yourself by building SwiftPM from source and running swift package update --enable-new-resolver
.
Ankit Aggarwal fixed a bug in which SwiftPM could not be built using an Xcode application that had a space in its name.
Slava Pestov sent a massive pull request to refactor code completion and module interface printing in libAST and libIDE.
Joe Groff sent a pull request to implement SE-0139, NSValue bridging.
Accepted proposals
Andrew Trick’s proposal, SE-0138: UnsafeRawBufferPointer, was accepted.
Community feedback to this proposal was nearly all positive. It was pointed out that Foundation’s Data API should make use of this new type, and there is a clear intention to do that. The core team agrees that the proposal is a reasonable addition to make in Swift 3 because it fills in missing functionality from SE-0107: UnsafeRawPointer and will help with code migration. As a result of the discussion, the proposed component’s name was changed from
UnsafeBytes
toUnsafeRawBufferPointer
; that change is already reflected in the proposal.
Mailing lists
Ever think you’d be able to ask @swift-ci please test Android
? Well, Apple is considering additional CI platforms, including one for Android. Brian Gesiak sent an email with a summary of the approach being considered, as well as an offer of additional resources to make it happen.
Between Xcode 7.3.1, Xcode 8, and Xcode 8.1 beta, you probably have more than one Xcode installed right now. Brian Gesiak asked about how to compile Swift with a specific version of Xcode. Daniel Dunbar explained it can be done by setting the DEVELOPER_DIR
when compiling.
Updating Xcode is a chore no one is free from – not even Apple’s continuous integration servers. Nicole Jacque announced some downtime to install Xcode 8.1 beta.
Ron Olson confirmed that Swift builds on Ubuntu 16.
Finally
The long winter is over: Steve T-S is back on Twitter. He’s uncovered interesting iOS internals like SceneKit’s SCNHeadMountedDisplayRenderingTechnique
, and released a Swift playground that allows you to browse files on your iPad.