On Leaving Swift for Rust
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
On Leaving Swift for Rust
Yesterday I resigned from the Swift Android workgroup. I’ve received a number of inquiries about this, and rather than responding individually to each one, I figured I would just write up a post with my reasoning and submit it to the public record. First off, my resignation was not triggered by any sort of conflict, grievance, or specific incident.
昨天我辞去了 Swift Android 工作组的职务。我收到了许多相关的询问,与其逐一回复,我想还是写一篇文章说明我的理由并公之于众。首先,我的辞职并非由任何冲突、不满或特定事件引发。
Early Swift community efforts got off to a rough start when Swift language creator Chris Lattner quit due to what he described as a “toxic environment”. This event predates my direct involvement in the project, so I am not privy to the specifics. But I want to be clear that this was in no way my experience: everyone I interacted with, both from Apple and external organizations, both in meetings and in forum discussions and direct messages, have been polite, courteous, and the paragon of civility and professional conduct.
Swift 社区早期的工作进展并不顺利,当时 Swift 语言的创建者 Chris Lattner 因他所描述的“有毒环境”而离职。这一事件发生在我直接参与该项目之前,所以我并不了解具体细节。但我必须明确,这绝非我的个人经历:我所接触到的每一个人,无论是来自苹果公司还是外部组织,无论是在会议、论坛讨论还是私信中,他们都表现得礼貌、客气,堪称文明与职业操守的典范。
Despite Apple having an ancient blood feud with Android, and my own rather acrimonious relationship with certain divisions of the company, every single one of my direct interactions with the Swift team has been pleasant and productive. I will miss our meeting and chats, and I harbor zero ill-will towards the project or any of the individual members I’ve worked with. So why quit?
尽管苹果与 Android 之间有着长期的积怨,而我本人与该公司某些部门的关系也相当紧张,但我与 Swift 团队的每一次直接互动都是愉快且富有成效的。我会怀念我们的会议和交谈,我对该项目或我共事过的任何成员没有任何恶意。那么,为什么要退出呢?
Computer Languages, Past and Future By way of background, I’ve been programming for over 40 years. I started with Basic, then Pascal, on to C, then C++, over to Java, up to Scala, back down to Kotlin, around to Objective-C, before finally landing on Swift. Swift is a delightful language: I loved it from day one and I’ve been boosting it around the world since 2014.
计算机语言的过去与未来。作为背景,我已经编程超过 40 年了。我从 Basic 开始,接着是 Pascal,然后是 C、C++,转到 Java,进阶到 Scala,退回到 Kotlin,绕到 Objective-C,最后落脚于 Swift。Swift 是一门令人愉悦的语言:我从第一天起就爱上了它,并自 2014 年以来一直在全球范围内推广它。
Swift really “does what it says on the tin”: it couples the performance of C++ with the ease of Java. And Swift is as developer-friendly as it gets: an intuitive object-oriented syntax coupled with maximally efficient value types, fabulous tooling (on Apple platforms), and a thoughtfully-designed build system. I have not soured on Swift: I think it is an excellent language, and it is here to stay.
Swift 确实“名副其实”:它结合了 C++ 的性能与 Java 的易用性。Swift 对开发者极其友好:直观的面向对象语法、最高效的值类型、出色的工具链(在苹果平台上)以及设计精良的构建系统。我并没有对 Swift 感到失望:我认为它是一门优秀的语言,并且会长期存在。
But it is here to stay in that same straight-and-narrow lane shared by all corporate-directed languages, like C# is here to stay for Microsofties and like Kotlin is here to stay for Androidophiles. Which isn’t bad in and of itself: if you want to write software solely for [CORPORATE PRODUCT], then [CORPORATE LANGUAGE] will always be well-maintained, supported, and they will always provide support for their latest products, with an easy migration path forward.
但它的存在局限于所有企业主导语言所共有的那条狭窄轨道,就像 C# 之于微软员工,Kotlin 之于 Android 爱好者一样。这本身并没有什么不好:如果你只想为 [企业产品] 编写软件,那么 [企业语言] 将始终得到良好的维护和支持,它们总是会为最新产品提供支持,并提供简单的迁移路径。
They are the safe and happy path, as long as you stay in your lane and limit your ambitions to writing software for [CORPORATE PRODUCT]. But when you stray from that happy path, the rough edges start surfacing, and there is no one getting a paycheck to smooth those out. Swift for Android/Windows/other-non-Apple-platform is in exactly that position: yes, it technically works, and yes, the language steering committees are committed to continuing the level of support they promised, but it will never be the same seamless experience as developing for iOS/watchOS/visionOS/whateverOS.
只要你安分守己,将目标限制在为 [企业产品] 编写软件上,它们就是安全且愉快的路径。但当你偏离这条路径时,粗糙的边缘就会显现出来,而没有人会领着薪水去打磨它们。Swift 在 Android/Windows 或其他非苹果平台上的处境正是如此:是的,它在技术上可行,语言指导委员会也承诺继续提供所承诺的支持水平,但它永远无法提供与开发 iOS/watchOS/visionOS 等系统时相同的无缝体验。
This extends beyond the language and into the tooling: Skip enables you use Xcode to develop your apps in parallel for iOS and Android, but this has only been achieved in the face of Xcode’s constitutional hostility towards doing anything other than optimizing for their own first-party平台.
这不仅限于语言,还延伸到了工具层面:Skip 使你能够使用 Xcode 并行开发 iOS 和 Android 应用,但这只有在面对 Xcode 对优化自身第一方平台以外的任何事物所持有的固有敌意时,才能实现。
The Rise of the Clankers If humanity were destined to continue creating software solely with their monkey brains and meat fingers, Swift would likely be the language I would have stuck with until the day I retired. But that isn’t the trajectory we are currently on. Barring such speculative calamities as “model collapse”, Butlerian Jihad, or Skynet, we have taken a turn in a new direction.
机器人的崛起。如果人类注定只能用猴脑和肉指来创造软件,Swift 很可能是我会一直坚持到退休的语言。但我们目前的发展轨迹并非如此。除非发生“模型崩溃”、巴特勒圣战或天网等推测性的灾难,否则我们已经转向了一个新的方向。
We software developers have collectively [as/de]cended to a plane where we now direct the computers to write our computer code, and these computers have decided that they really prefer computery languages over the humany languages. Humany languages are those designed to fit inside our wonderful little biological brains. I have grave reservations about all of this from many perspectives: ethical, ecological, political, socio-economical (just to name a few).
我们软件开发者已经集体进入了一个层面,我们现在指挥计算机来编写代码,而这些计算机决定了它们确实更喜欢“计算机语言”而非“人类语言”。人类语言是那些旨在适应我们奇妙的小生物大脑的语言。我从伦理、生态、政治、社会经济等多个角度对这一切都有严重的保留意见(仅举几例)。
But it is what it is, and all but the most ardent of refusenik software developers have come around to this view in the past 6—12 months. Swift isn’t a computery language, it is a developer-friendly humany language: it is a better Java, a better C#, and a (much) better Objective-C. Throughout my career I’ve been able to accomplish amazing feats in these languages, disproportionate to my limited intellect and abilities, but that comes at the cost of these languages being hobbled in pursuit of their mission to slice and dice complex problems in such a way as to be tractable for one or more human brains.
但事实就是如此,除了最坚定的抵制者外,所有软件开发者在过去 6 到 12 个月里都已经接受了这一观点。Swift 不是一种计算机语言,它是一种对开发者友好的人类语言:它是更好的 Java,更好的 C#,以及(好得多的)Objective-C。在我的职业生涯中,我能够用这些语言完成惊人的壮举,这与我有限的智力和能力不成比例,但代价是这些语言为了实现其使命——即以一种能被一个或多个人类大脑处理的方式来拆解复杂问题——而受到了束缚。
I speak of object-orientation; I speak of automatic memory management. But there is one very computery language that until recently has been waiting in the wings… All roads lead to Rust.
我指的是面向对象;我指的是自动内存管理。但有一种非常“计算机化”的语言,直到最近才在幕后蓄势待发……条条大路通 Rust。
In February, Andreas Kling dropped Swift for Rust for the Ladybird browser, a 180° turnabout from their opposite decision from a year earlier. In July, Jarred Sumner ported Bun from Zig to Rust. In September, David Heinemeier Hansson filicided Ruby on Rails for Rust. And this trend is only accelerating: nearly every week there is some new project converting some massively complex codebase from language X to Rust. PostgreSQL! The TypeScript compiler! These projects are coming fast and furious with no sign of slowing down. And for every one of these projects, over 95% of the code was not written by a human.
二月,Andreas Kling 为 Ladybird 浏览器放弃了 Swift 转而使用 Rust,这与他们一年前的决定相比发生了 180 度的转变。七月,Jarred Sumner 将 Bun 从 Zig 移植到了 Rust。九月,David Heinemeier Hansson 为了 Rust 而“杀死了” Ruby on Rails。这种趋势正在加速:几乎每周都有新的项目将极其复杂的代码库从 X 语言转换为 Rust。PostgreSQL!TypeScript 编译器!这些项目来势汹汹,且没有放缓的迹象。对于这些项目中的每一个,超过 95% 的代码都不是由人类编写的。
Swift is wonderful. It enabled me to bring iOS development to Android through Skip and share a single codebase between the two dominant mobile platforms. LLMs are quite proficient with Skip: Claude or Codex can one-shot a passable prototype for a new iOS+Android app written in Swift in a matter of minutes and you can have it running side-by-side on emulators.
Swift 很棒。它使我能够通过 Skip 将 iOS 开发引入 Android,并在两个主流移动平台之间共享单一代码库。大语言模型对 Skip 非常精通:Claude 或 Codex 可以在几分钟内一次性生成一个用 Swift 编写的 iOS+Android 应用原型,并且你可以让它在模拟器上并排运行。