Most kernels are written in C, and for good reasons: it is close to the metal, predictable, and universally supported. But "close to the metal" has always come with a tax — manual memory management, undefined behavior, and a class of bugs that mature tooling only partly contains.
The Embedded Swift bet
Embedded Swift compiles Swift without a garbage collector or a heavy runtime. The swift-os kernel is fully freestanding: no Foundation, no standard library. You keep value types, ~Copyable ownership with deinit for resources (pages, locks, handles), and the type system; you drop the parts that assume an allocator and a runtime are always present.
The goal was never "Swift because we like Swift." It was memory safety and modern ergonomics with a cost model we can actually predict.
What we give up — on purpose
Value types and Unsafe* pointers at the low level; classes only after the heap is up, and sparingly, because ARC has a cost on hot paths. That discipline is a feature — it keeps the trusted core small and legible.
What we get back
- A compiler that catches whole categories of mistakes before boot.
- Code in the kernel that reads like application code.
- One language across the kernel, the userland, and the host build tools.