October 29th, 2024

Swift – A great language strangled by governance

Apple's governance of Swift faces criticism for prioritizing corporate interests over community input, leading to increased complexity and a disconnect between developer needs and the language's original vision.

Read original articleLink Icon
FrustrationDisagreementSatisfaction
Swift – A great language strangled by governance

Apple's governance of the Swift programming language has drawn criticism for prioritizing corporate interests over community input and the language's original vision. Swift, created by Chris Lattner in the early 2010s, was initially celebrated for its simplicity and composability. However, since Lattner's departure in 2017, the language has become increasingly complex, with 217 reserved keywords and features that diverge from its foundational principles. The governance model, described as a "Corporate Dictator for Life," places Apple in control, leading to decisions that favor proprietary frameworks like SwiftUI over community-driven enhancements. This has resulted in a disconnect between the needs of developers and the direction of the language, as Apple prioritizes profit and internal timelines over open-source collaboration. The article highlights the contrasting governance structures of other programming languages, such as Python and Rust, which allow for more community involvement and deliberation. The author argues that Swift's current trajectory reflects a troubling trend where corporate interests overshadow the collaborative spirit essential for the language's growth and sustainability.

- Swift's governance is criticized for prioritizing Apple's corporate interests over community input.

- The language has become more complex, straying from its original vision of simplicity and composability.

- Apple controls the Swift project, leading to decisions that may not align with developer needs.

- Other programming languages like Python and Rust have more effective community-driven governance models.

- The disconnect between developers and Apple's priorities raises concerns about Swift's future.

AI: What people are saying
The comments reflect a diverse range of opinions on Swift's governance and complexity, with several common themes emerging.
  • Many users express satisfaction with Swift's design and usability, arguing that its complexity is justified by its capabilities.
  • Criticism of Apple's governance is prevalent, with some commenters feeling that it prioritizes corporate interests over community input.
  • Concerns about the language's increasing complexity and compiler performance are frequently mentioned, with calls for improvements in error messages and build times.
  • Some commenters highlight the need for better cross-platform support and a more robust ecosystem for server-side development.
  • There is a divide between those who appreciate Swift's evolution and those who feel it has strayed from its original vision, leading to frustration among developers.
Link Icon 26 comments
By @danpalmer - 5 months
This just doesn't match with my experience of Swift. My experience is a language that is well designed, at times feeling too complex, but always justifying that complexity with correctness when I dig into the reasons. Most of the language is driven by an open process, to the point that language announcements at WWDC are only a recap of the last year of accepted enhancement proposals.

"A great language strangled by governance" – it's not clear to me that Swift is in a materially worse place than any of the 3 alternatives this post points to. Rust has had a lot of drama and botched their async/await, Python had 3, took a decade to recover, and has failed to address its terrible packaging over the last 2 decades, and the Kotlin process described sounds almost identical to the Swift process.

Was Swift entirely top-down controlled at the beginning, with a bunch of breaking changes? Yes, but it has very clearly graduated from its early development now with no forced breaking changes and an open proposal process that is clearly working. Has Swift hard-coded Apple framework exceptions? Maybe, but that has never gotten in the way of me using or understanding Swift code, so I'm not sure it affects me as a developer. Has Swift become a hugely complex compiler? Sure, but I'd rather have a complex compiler and a better developer experience, especially if Apple is paying for it.

I don't disagree with the facts here, this just doesn't resonate with me at all. I'm a very happy Swift user, would like to be using it a lot more, and enjoy the forward momentum in the ecosystem as Swift becomes in my mind one of the most advanced languages available.

By @saagarjha - 5 months
This is an insulting piece. It's a poor hitjob by someone who doesn't really know what is going on, which is extra unfortunate because Swift has a bunch of problems. Some of them are actually adjacent to the claims here! But this is just unsubstantiative flamebait.

Swift is controlled by Apple, Inc. Nobody worth listening to is denying that. The steering committee is almost all Apple employees, most of the commits going in come from people who commute to Cupertino, and whatever the progress is on Windows or Arduino or whatever, it's clear that "first class" really means iOS. That's all true. Apple makes proposals, they seek some community input, and in the end they pick what they like and it ends up in the language.

But even with that said, the rest of this post is of low quality. Tim Cook and his MBA buddies didn't personally come in to ruin the language because the shareholders aren't making money. Chris Lattner is, whatever his contributions to the language previously, just a guy. He would probably try to put Swift on GPUs today if he had his way. It's not the first time he sold it out before. You've got to go beyond "omgz so many keywords so complicated!!1!!" and look deeply at the real sources of complexity. Swift has a powerful generics system that has worst-case behavior that really sucks. The discussion process has a bunch of busybodies that have nothing better to do than talk about names of things. Yes. These are real problems. It's funny when there are random hacks in the source code to support things that Apple is shipping. But that is how a large project works. You are more than welcome to laugh about it on Twitter but substantive criticism it is not. Which is a shame, because there is plenty of it go around.

By @jeswin - 5 months
I've used Python for nearly two decades. It's not a great programming language to write or maintain, and its package management makes npm (which is not great itself) look like a walk in the park. It's a bit unfortunate that it became AI's go-to programming language.

I know it's subjective, but if we're arguing about Swift's quality by comparing with Python, I'm not buying it.

By @dadoum - 5 months
I also think Swift is getting bloated (and this can be seen in the compile times which are getting out of hand). Sometimes I feel like some features of Swift have been implemented without being well thought about, just because they are popular in the programming crowd. I am thinking more specifically about metaprogramming, which was originally a non goal, but I guess with time they saw it has a point and they replicated Rust's approach with syntactic macros which is to me a very poor approach. You need to much boilerplate to write a macro since it's a compiler plugin basically, and you can't interpret the semantic of the underlying code without reimplementing part of compiler's logic. I can find other examples, and that's not always bad, but I am not sure that's the right way of designing a language.
By @kaishin - 5 months
This article is full of statements that are not backed up by any material proof. The author claims that Swift features no longer compose without giving a single example. I write Swift SDKs for a living and I have never thought that any of the recent features felt incompatible, incongruous, or redundant. Sure, each has its strengths and weaknesses, but that results in an expressive language where every problem has several solutions with different tradeoffs.

When it comes to governance, it’s not without wrinkles, but it’s not as bad as the author makes it sound. If anything, things got a bit less “dictatorial” since Chris left. Different core team members pull in slightly different directions which made the language more balanced in my view.

By @tayistay - 5 months
If you have a recent machine, the actual developer experience isn't too bad. It's just not a language for language purists (was it ever?).

I'm enough of a purist to be annoyed whenever I see the "expression took too long to type check" error. (I think bidirectional type inference isn't worth it with Swift)

The gaggle of verbose pointer types makes me want to switch to C++ whenever I have to deal with memory directly.

As the article mentions, a bunch of features were added for the sake of SwiftUI. Function builders allow SwiftUI's syntax to be minimal. They allow you to write:

  VStack {
     SomeView()
     AnotherView()
  }
instead of something like

  VStack(
     SomeView(),
     AnotherView()
  )
Given the rather bad (still!) error messages you get with SwiftUI that seem to be a result of function builders, I'd say it wasn't worth it. At least I get fewer of the "couldn't produce a diagnostic, please file a bug" errors than I used to.

Then there are property wrappers, which wrap struct/class fields with get/set code (IIRC Lattner didn't like the property wrappers). They've been partially replaced in SwiftUI by macros. The @Observable macro (probably the most widely used one) decorates your class with code that notifies listeners (almost always SwiftUI) of changes. I'd be curious to see what SwiftUI would look like without property wrappers (or macros).

I think they had a missed opportunity to really add robust updating of views in response state changes. Currently it's still relatively easy to not have your SwiftUI views update because your data model uses some object that isn't @Observable.

I wrote a UI library inspired by SwiftUI, but in Rust [1], and of course I couldn't add anything to the language, and more experienced Rust programmers discouraged me from using macros. So it can be done without all the extra stuff Swift added.

[1] https://github.com/audulus/rui

By @mythz - 5 months
Every few years I revisit Swift to see if things have improved but the language is now even more complex with cryptic compiler errors and poor runtime error messages, long build times and slow iteration times. Xcode is still a horrible IDE and unfortunately JetBrains AppCode has since been discontinued, basically forcing using VS Code for development and Xcode to run/debug tests. It can finally do async/await but its async http requests were unstable/unusable on Linux and cross platform is a chore with littering macros like `#if canImport(FoundationNetworking)` everywhere.

Used to think Swift was the future given the resources Apple could throw behind it, but at its current state after 10 years I no longer do. It will remain a mainstay thanks to the Apple ecosystem, but don't see its popularity extending far beyond that.

By @aaronbrethorst - 5 months
I think Swift has been strangled, but I'm not convinced it's because of its governance structure (with Apple at the top). I get the impression that Swift is the world's best sandbox for programming language nerds to play in—and that Apple is woefully understaffing the team writing technical copy for the compiler (e.g. error messages), and the documentation.

The rate at which the Swift language has changed just in the past 3 years feels as significant as the rate at which it changed between 2016, with the release of Swift 3, and 2022.

I'm sure that people who are 100% all in on iOS development feel like the rate of change is delightful, but for the rest of us who have other responsibilities, it's exhausting and bewildering.

By @quotemstr - 5 months
Who cares about keyword count? Reserved words preserve flexibility while not realistically impairing programmer expression. What do you do with a keyword-impoverished language?

1) overload the keywords you do have to mean random unrelated things depending on context (which is why "static" in C++ means a bunch of random things), or ' 2) create context-dependent keywords (e.g. "final" in C++ and "match" in Python), which work, but complicate every parser everywhere.

As much as it pains me to type the following: JavaScript got it right. The initial version of the language reserved a number of keywords (e.g. "class") that would only become useful two decades later.

By @willtemperley - 5 months
Surely the "some" keyword the author is railing about actually _improves_ composability, and is in fact exactly in line with Lattner's vision "Simple things that compose." The accepted answer here [1] explains this better than I can.

I can't share the author's enthusiasm for Swift on server either. WASM support is not production ready so Cloudflare workers or Deno deploy is out. Vapor is the only properly maintained framework I can find (happy to be corrected) which I did not find ergonomic. Google Cloud Functions or AWS Lambda would be options but there's no reason to limit oneself when Rust is production ready on most web platforms.

[1] https://stackoverflow.com/questions/56433665/what-is-the-som...

By @jamil7 - 5 months
I don’t necessarily disagree with the article but I think the language is in a much but better place than it was a few years ago, with a few exceptions. As the author points out, Foundation and a bunch of frameworks and libraries are being open sourced and maintained by Apple and the Swift foundation which are all cross platform (including Windows and Linux).

The static concurrency checking stuff is cool on paper but has so far just introduced noise to our codebase so we’re not touching it until it cooks a little more.

I’m basically asking for the same thing I was 5 years ago though and the author touches on, fix the compiler issues.

Official Android support would be nice too but the community is filling the gap there.

I use Rust a little on the side and tooling, compiler messages and ecosystem are far ahead of Swift. Language wise I still prefer Swift for the work I do.

By @easeout - 5 months
Swift has a lot of features, but you can leave many of them alone to begin with and learn them when you need them. Low-syntax defaults work in a reasonable, streamlined way. SwiftUI will confront you with more syntactic variations than other Swift code, but that's not unusual in a DSL. Overall it's a smooth learning curve due to progressive disclosure in language features.

If Swift compiled five times faster, I would want for very little. But I don't know how they'd walk back the combination of type-based overloading and implicit conversions. See: https://belkadan.com/blog/2021/08/Swift-Regret-Type-based-Ov...

By @Heliosmaster - 5 months
A honest question here from outside of the Swift world: why does it matter?

I'm a Clojure developer, have been exclusively one for the last 10 years and have no intention of changing anytime soon (in other words, I don't care/follow closely what the majority of development world is and what the trends are). A few years ago we had "Open Source is Not About You" [1] by Rich Hickey, basically pushing back that the creator(s) of Open Source don't owe anything back to the community. That piece has aged well for me: now I understand that something is what it is, not what I wish it was. And more importantly, the goal of open source isn't to be liked or used by everybody. It's a thing put out by its creator for others to use, and that includes Apple.

So really, why does the governance matter so much? If you don't agree with something, why not fork it and make it like you want it?

[1]: https://gist.github.com/richhickey/1563cddea1002958f96e7ba95...

By @lukeh - 5 months
Look, I wish the compiler was faster and the diagnostics more helpful but I find Swift pretty great! And I'm using it on Linux.
By @zer0x4d - 5 months
Call me a fanboy, but Swift is one of the best languages I've ever had the privilege of using. I'm truly hopeful with some more work, it's able to become the de-facto cross-platform language.

The complexity is very manageable, a decent Java, Objective-C or .NET developer can pick it up in less than a day, is feature-packed and stuff just make sense.

By @KingOfCoders - 5 months
Ladybird switching to Swift made me think. Then there was this article recently on HN on Swift vs. Rust. I would give Swift a chance, I do think currently it lacks open source projects for server side development (all the batteries).
By @randomNumber7 - 5 months
I think Swift is a really nice language when you look at the design. I really liked protocol extensions for example.

The problem I have with it is that some decisions are very ideologic.

You can easily link to C libraries for example, but the pointer types in Swift are so fucking unusable (because pointers are evil) that it makes no sense to try it. (unless you cannot chose an other language)

By @pjmlp - 5 months
It doesn't matter, because Swift is one of those languages that enjoys an overlord, anyone that wants to target its overlord platforms eventually has to deal with Swift.

Same with Java and Kotlin on Android, .NET and C++ on Windows, JavaScript on the Web, ISO C on UNIX/POSIX, Go on Docker/Kubernetes,....

By @jakey_bakey - 5 months
Thanks so much for sharing my work! :)

The devs here are a lot more nuanced than the guys on Reddit lol

By @w10-1 - 5 months
I disagree. [edit: sorry: not completely?]

Decisions are made openly with excellent (if exhaustive) discussion, clear reasoning, and mostly on the merits.

Features are building on prior features over the years, and when things have needed to be changed or deprecated, they get changed. So the language is alive but not encrusted.

Decisions are made much more independently and quickly than Java, which has a similar installed code base and motivated corporate patron. Both small-scope and sweeping architectural changes work through the evolution process pretty quickly.

All languages starts with a clean sweet spot but major gaps, and then migrate to common features as they age. Right now, Swift has probably the most mature concurrency plan of all languages, and is beginning to address the lifetime issues presented by value types.

No other language blends low-level efficiency and control with high-level type-safety so well - no less seamless inter-op with C/C++, static macros, etc.

What's not maturing as fast: third-party libraries ecosystem because most people just need Apple's, Windows support (because - why?), and alternate IDE's, static analysis, etc.

As for 217 keywords, etc.: be glad there's a name for everything, without a plethora of ways to do the same thing. If it weren't easier to do complicated things with a correspondingly complicated language, everyone would be writing functional lisp code.

The real problem now is there's no real agreement on how to do the function coloring, effects, traits, etc., but that's what's needed to make use of modern hardware.

In particular, the type system being bidirectional has made it both pleasant (when it works) and painful (when it doesn't), and stuffing all this new behavior into a type system constraint solver is a bit of a black art. Venn diagrams and verbiage aside, it's just hard for people to think about, e.g., what ~Copyable means for generic parameters, or how a parameter can place a function in a different memory region.

But they'll do it after a boatload of discussion, and then make a dumbed-down happy-path 10-minute video for WWDC with code folks can play with - 10 million folks.

If anything, the language is strangled by history, but remains attractive because the team does such a good job.

By @alexashka - 5 months
Swift will be fine as long as they invest in Mini-Swift that improves compile times by 10x and make it seamlessly interop with Papa-Swift the current behemoth.

I'm sure they're aware of the compile times. If they can make C++ interop work (not easy), they can make Mini-Swift :)

As for this governance talk - I can only shake my head at these attempts to start drama. I don't understand it.

By @p0w3n3d - 5 months
Paywalled?
By @shmerl - 5 months
> Apple has the purest incentive of all: maximise profit for shareholders.

I'd call it the impurest incentive of all.