Sunday, April 1, 2018

Swift 4.1

Ted Kremenek:

Swift 4.1 adds more generics features to the language, furthering the goals set out in the Swift Generics Manifesto. The following generics-related proposals have been implemented in this release:


These are additional Swift Evolution proposals that were implemented in this release:

This was a fun update because it was easy to update my code, and I was able to delete lots of boilerplate related to Equatable and IndexDistance. Synthesized Equatable and Hashable conformance makes the code much more concise and potentially more reliable. It still has some room for improvement, though: there’s no way to omit fields without implementing the methods yourself, and the internal function for combining hash values is not exposed as API.

See also: Replacing flatMap With compactMap.

Previously: Swift 4: Synthesizing Equatable and Hashable Conformance, Swift 4.1 Conditional Conformance Is Amazing, Code Size Optimization Mode in Swift 4.1.

Update (2018-04-03): Ben Cohen:

Hashing needed some more work before this could happen, but @lorentey has been working on a proposal to turn the hashing improvements he landed in 4.2 into a proposal for a public API.

See also: Accidentally Quadratic Rust Hash Tables.

Update (2018-04-12): Joe Groff (tweet):

The core team discussed this proposal in our meeting today. There are still a couple days left in the review period, but we’re tentatively inclined to accept this proposal, but wanted to suggest some changes based on public review discussion and our own review[…]

2 Comments RSS · Twitter

[…] Swift 4.1, Swift 4: Bridging Peephole for “as” […]

[…] Previously: Swift 4.1. […]

Leave a Comment