Skip to main content
Dispatches
  • blog
  • /
  • briefs
  • /
  • projects
  • /
  • about
Back to all briefs

Swift Warts

Briefs about unfortunate pain points in the Swift language and standard library

  • Definition Order Matters in Swift Packages

    You Can Use Helpers in Package.swift, but only if they are defined before use.

  • Lack of a decltype Equivalent

    In the absence of a decltype-like mechanism, some nice-to-have macros wind up unimplementable

  • You Cannot Express Generic Actor Isolation Parameters

    Swift lets you write @MainActor and @SomeOtherActor, but not @'A, where A is a generic actor parameter.

  • Lazy Sequences Lack Primary Associated Types

    You can write Sequence<Element> but not LazySequenceProtocol<Element>

  • Lazy Sequences Lack Primary Associated Types

    You can write Sequence<Element> but not LazySequenceProtocol<Element>

  • Name Collisions in Result Builders

    You get a ForEach, and you get a ForEach, and...

  • First Trailing Closure Cannot Have a Label

    Swift forbids labeling the first trailing closure, which can be a surprising obstacle to idiomatic API design.

  • Lazy Sequences "Decay" Easily

    Swift's lazy functional API is elegant, but prone to silently decaying back to its eager equivalent.

© 2024 | Dispatches