News for hackers. Stuff that matters.
Re:Swift at Apple: Migrating the Password Monitoring Service... by dontlaugh on Tuesday June 03, 2025 @03:44PM (#44173859)
Go is similar to Swift when it comes to mandatory costly abstractions.

It’s only Rust (or C++, but unsafe) that have mostly zero-cost abstractions.

Re:Swift at Apple: Migrating the Password Monitoring Service... by frizlab on Tuesday June 03, 2025 @03:56PM (#44174010)
Swift have them too now (non-Copyable types).
Re:Swift at Apple: Migrating the Password Monitoring Service... by airspeedswift on Tuesday June 03, 2025 @04:33PM (#44174408)
Swift, Rust, and C++ all share the same underlying techniques for implementing zero-cost abstrations (primarily, fully-specialized generics). The distinction in Swift's case is that generics can also be executed without specialization (which is what allows generic methods to be called over a stable ABI boundary).

Swift and Rust also allow their protocols to be erased and dispatched dynamically (dyn in Rust, any in Swift). But in both languages that's more of a "when you need it" thing, generics are the preferred tool.

Re:Swift at Apple: Migrating the Password Monitoring Service... by dontlaugh on Tuesday June 03, 2025 @05:55PM (#44175200)
To an approximation, but stdlib and libraries will have a bias. In practice, abstractions in Rust and C++ more commonly are actually zero-cost than in Go or Swift.

This is not a bad thing, I was just pointing out that Go doesn't have a performance advantage over Swift.

Re:Swift at Apple: Migrating the Password Monitoring Service... by rafram on Tuesday June 03, 2025 @05:01PM (#44174684)
> It’s only Rust (or C++, but unsafe) that have mostly zero-cost abstractions.

This just isn't true. It's good marketing hype for Rust, but any language with an optimizing compiler (JIT or AOT) has plenty of "zero-cost abstractions."