Issue #111 14 Jun 2018
Written by: Roman Volkov
Hi there SwiftWeekly readers! The last two weeks were full of exciting news with WWDC, interesting discussions on the Swift Unwrapped podcast and there’s plenty of new starter tasks for you, especially for SPM. Enjoy!
Starter tasks
- SR-7823 [Package Manager] swift run intermingles SwiftPM status with tool output on stdout
- SR-7824 [Package Manager] SwiftPM ignores missing source symlinks
- SR-7825 [Package Manager] SwiftPM should consider a target with header files but no sources as a ClangTarget
- SR-7826 [Package Manager] SwiftPM should warn if it skips traversing a symlink which would contain sources in it
- SR-7829 [Package Manager] Bad error message when a tag doesn’t exist
- SR-7904 [Compiler] AST dump - can’t distinguish files
- SR-7933 [Tooling] SourceKit double-counts escaping and autoclosure attributes
- SR-7979 [Package Manager] Circular Dependency in SwiftPM Causes Segfault
Submit a task by sending a pull request or opening an issue.
Swift Unwrapped
In episode 61, Jesse and JP with special guest Greg Heo discussed general announcements from WWDC 2018, not just limited to the Swift language.
In episode 62, Jesse and JP talk with Ted Kremenek, the Swift Project Lead and manager of the Languages and Runtimes team at Apple.
News and community
The biggest news from the past two weeks is, of course, WWDC. There are plenty of videos to watch, but take a closer look into these Swift related videos:
- What’s New in Swift
- Swift Generics
- Getting to Know Swift Package Manager
- Behind the Scenes of the Xcode Build Process
Ole Begemann made an easy-to-use playground that you can use to test the new features in Swift 4.2. If you prefer to read about it, check out Cosmin Pupăză’s article What’s New in Swift 4.2?.
Greg Heo wrote a new post on Swift Unboxed, Swift Diagnostics: #warning and #error, about the new #warning
and #error
directive implementations.
Brian Gesiak wrote the second part of a great article about the interaction between the Swift frontend and LLVM in terms of emitting diagnostics.
Commits and pull requests
Erik Eckstein merged optimizations for generation of optimal code for static String constants.
Xcode 10 Beta is now required to build master
and swift-4.2-branch
: #17000 and #17001.
Adrian Prantl merged “Use depth and index to lookup type metadata artificial variables”. The general purpose: “debug info support for generics is about to get a whole lot better”.
Slava Pestov fixed availability of inherited designated initializers.
Inherited designated initializers got the same availability as the corresponding initialier in the superclass. However if the superclass was more available than the subclass, we would generate a diagnostic that a member cannot be more available than its containing type. This diagnostic had an unknown source location, since the location was for a synthesized declaration, causing confusion.
Proposals in review
SE-0215: Conform Never
to Equatable
and Hashable
is under review.
Never
is very useful for representing impossible code. Most people are familiar with it as the return type of functions likefatalError
, butNever
is also useful when working with generic classes.For example, a
Result
type might useNever
for itsValue
to represent something that always errors or useNever
for itsError
to represent something that never errors.Conditional conformances to
Equatable
andHashable
are also very useful when working withenum
s so you can test easily or work with collections.But those don’t play well together. Without conformance to
Equatable
andHashable
,Never
disqualifies your generic type from beingEquatable
andHashable
.
SE-0216 Introduce user-defined dynamically “callable” types is under review.
This proposal is a follow-on to SE-0195 - Introduce User-defined “Dynamic Member Lookup” Types which shipped in Swift 4.2. It introduces a new
@dynamicCallable
attribute, which marks a type as being “callable” with normal syntax.[…]
Swift is exceptional at interworking with existing C and Objective-C APIs and we would like to extend this interoperability to dynamic languages like Python, JavaScript, Perl, and Ruby. We explored this overall goal in a long design process wherein the Swift evolution community evaluated multiple different implementation approaches. The conclusion was that the best approach was to put most of the complexity into dynamic language specific bindings written as pure-Swift libraries, but add small hooks in Swift to allow these bindings to provide a natural experience to their clients.
Finally
And finally — time to get some rest!