Remix.run Logo
AceJohnny2 3 hours ago

> It seems unlikely [Apple] would throw away that investment and move to Rust.

Apple has invested in Swift, another high level language with safety guarantees, which happens to have been created under Chris Lattner, otherwise known for creating LLVM. Swift's huge advantage over Rust, for application and system programming is that it supports an ABI [1] which Rust, famously, does not (other than falling back to a C ABI, which degrades its promises).

[1] for more on that topic, I recommend this excellent article: https://faultlore.com/blah/swift-abi/ Side note, the author of that article wrote Rust's std::collections API.

gjajric 2 hours ago | parent [-]

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.

astrange an hour ago | parent | next [-]

There's an allocation-free subset.

https://www.swift.org/get-started/embedded/

Rust's approach is overkill, I think. A lot of reference counting and stuff is just fine in a kernel.

gjajric2 31 minutes ago | parent [-]

But at least a lot of tasks in a kernel would require something else than reference counting, unless it can be guaranteed that the reference counting is optimized away or something, right?

pornel 29 minutes ago | parent | prev | next [-]

Apple is extending Swift specifically for kernel development.

pjmlp 2 hours ago | parent | prev | next [-]

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

gjajric2 34 minutes ago | parent [-]

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...

pjmlp 17 minutes ago | parent [-]

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.

saagarjha an hour ago | parent | prev [-]

Nothing wrong with using reference counting for OS development.

gjajric2 33 minutes ago | parent [-]

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