Now that the holidays are over, things have started to pick up again on Swift.org. If you are following any of the repos on GitHub, you have probably noticed. I’m not sure how I missed this before, but this week I just discovered SwiftExperimental.swift. For now, it defines a bunch of custom unicode operators for Set
. It’s really cool. I would love to see more APIs like this in the standard library. Anyway, here’s the weekly brief!
Commits and pull requests
Austin Zheng submitted a pull request to remove to old mirror API.
Andrew Naylor merged changes to speed up JSON parsing in corelibs-foundation. We all know how much the Swift community loves JSON parsing.
Keith Smiley submitted a pull request to that adds support for the Swift package manager to corelibs-xctest.
Chris Lattner completely redesigned the AST representation of parameters.
Proposals
Matthew Johnson’s proposal to improve memberwise initializers is now under review. As Lattner pointed out, there are a number of deficiencies with the current memeberwise initializer behavior in Swift. I have a good feeling this will be accepted.
The proposal to “require self for accessing instance members” has been (thankfully) rejected. Some of the main reasons for this decision were that it (1) introduces verbosity rather than clarity, (2) diminishes the use of self.
as an indicator for possible retain cycles, and (3) teams wishing to adopt this usage could simply enforce it with a linter.
Doug Gregor has submitted a proposal for Generalized Naming for Any Function. From the introduction: “Swift includes support for first-class functions, such that any function (or method) can be placed into a value of function type. However, it is not possible to specifically name every function that is part of a Swift program — one cannot provide the argument labels when naming a function.” The lack of this feature is definitely a pain point in Swift, especially when working with Cocoa and Objective-C selectors. It’s a short read!
Mailing lists
Doug Gregor notes some surprising behavior when extending an @objc
protocol — the members of the extension
are not exposed to the Objective-C runtime. Luckily, I haven’t run into this bug myself.
Finally, is ?.
the “call-me-maybe” operator in Swift? That’s it for this week!