Hacker News new | ask | show | jobs
by ladyanita22 440 days ago
I'm a bit disappointed at the lack of interest Apple seems to have on Rust, given their focus on performance, UX and security.
2 comments

They created Swift as replacement for C, C++ and Objective-C, why should they bother with Rust?

Even Google on Android and ChromeOS is not exposing Rust to userspace, Java, Kotlin, C, C++, Javascript, Typescript, remain the official userspace languages.

Low-level code is being written in Rust. Of course userspace doesn't require low-level languages (and I don't quite get why C and C++ are exposed to the userspace and Rust is not).

Swift is not a replacemente for C and C++, but rather for Objective-C.

Do you have any sources for those claims?

>Swift is not a replacemente for C and C++, but rather for Objective-C.

Swift is not a replacement for anything; Apple will even say as much. It just fills the hole for a scripting language that they had for decades. Plenty of new Obj-C is still (and will continue to be) written for a long time.

Yes, Apple themselves, apparently folks wanting Apple to use Rust don't read Apple's documentation or watch talks done by Apple compiler developers.

> Swift was designed from the outset to be safer than C-based languages, and eliminates entire classes of unsafe code.

-- https://www.swift.org/about/

> Swift is a successor to the C, C++, and Objective-C languages. It includes low-level primitives such as types, flow control, and operators. It also provides object-oriented features such as classes, protocols, and generics.

-- https://developer.apple.com/swift/

"Introducing a Memory-Safe Successor Language in Large C++ Code Bases"

https://www.youtube.com/watch?v=lgivCGdmFrw

"So we feel pretty strongly, obviously at Apple our sucessor language is Swift and I am here to talk about features of Swift, both to try to sell you on to it, but also to talk about the things we think are pretty necessary and the ways in which a programming language can support, you know, clear code, safer and more correct code."

"Like I said before, Apple has always intended for Swift to be a sucessor language for all of our predecessors, from the top to the bottom of our stack, accessible to novices, powerful enough for experts, it is real a tall order.

From https://youtu.be/lgivCGdmFrw?t=1996 to https://youtu.be/lgivCGdmFrw?t=2042

"Swift as C++ Successor in FoundationDB"

https://www.youtube.com/watch?v=ZQc9-seU-5k

Oh, you seem to be right.

But isn't Swift lower-performing than C, C++ or Rust?

Not only does Metal use Swift bindings alongside Objective-C, as per John McCall's own words, that is the plan and to fix where that might still not be the case.

Embedded Swift project also started as means to replace Safe C use cases at Apple, like iBoot firmware.

https://support.apple.com/en-jo/guide/security/sec30d8d9ec1/...

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

Once upon a time, C compilers were quite lousy versus handwritten 8 and 16 bit Assembly code.

I believe their plan is to make Swift good enough to use in high-performance low-level scenarios. Some of their recent work has been to reduce implicit copies