Hacker News new | ask | show | jobs
by worik 224 days ago
Not really that much

It's been two years since I was an iOSSwift programmer, but the concurrent/parallel facilities were quite woeful. Memory protection no nonexsistant

I do not miss it. This might be useful for porting Apple software, but do not start new projects with it.

2 comments

Swift concurrency used to be a bit rough around the edges, but since Swift 5.5 it uses async/await and structured concurrency, which has been a massive improvement. We also have built in ways to handle data races around mutable state with actors and the main thread with @MainActor.

Rust has a more explicit and strict approach to ownership/borrowing for sure, but I’d argue Swift has worked to be memory safe be default since the start, with ARC, no unchecked pointer arithmetic in normal code, etc. it’s still tightly coupled to Apple platforms, but the swiftlang teams has been hard at work changing that and I think it’s a fine language to start new projects with in 2025.

async/await is useful

But what Swift lacked (in my day) was any support for parallelism.

They wrapped `fork` in a lot of mumbo jumbo, but it was just `fork`

May as well use C

> Memory protection no nonexsistant

Exclusivity is guaranteed by the compiler, and Apple has integrated tagged pointers on arm while Linux/x86 is still thinking about it.

Righto. "Non-existent" is going too far.

I played around with their threads and found it was trivial to corrupt memory and crash.