← Back to context

Comment by gjajric

3 hours ago

Swift does not seem suitable for OS development, at least not as much as C or C++.[0] Swift handles by default a lot of memory by using reference counting, as I understand it, which is not always suitable for OS development.

[0]: Rust, while no longer officially experimental in the Linux kernel, does not yet have major OSs written purely in it.

What matters is what Apple thinks, and officially it is, to the point it is explicitly written on the documentation.

  • The practical reality is arguably more important than beliefs. Apple has, as it turns out, invested in trying to make Swift more suitable for kernel and similar development, like trying to automate away reference counting when possible, and also offering Embedded Swift[0], an experimental subset of Swift with significant restrictions on what is allowed in the language. Maybe Embedded Swift will be great in the future, and it is true that Apple investing into that is significant, but it doesn't seem like it's there.

    > Embedded Swift support is available in the Swift development snapshots.

    And considering Apple made Embedded Swift, even Apple does not believe that regular Swift is suitable. Meaning that you're undeniably completely wrong.

    [0]:

    https://github.com/swiftlang/swift-evolution/blob/main/visio...

    • You show a lack of awareness that ISO C and C++ are also not applicable, because on those domains the full ISO language standard isn't available, which is why freestanding is a thing.

      1 reply →

Nothing wrong with using reference counting for OS development.

  • Even kernel development? Do you know of kernels where reference counting is the norm? Please do mention examples.