News for hackers. Stuff that matters.
Re:Swift 6 by astrange on Tuesday September 17, 2024 @09:38PM (#41574846)
This is an article about another language that can do that.
Re:Swift 6 by dogprez on Wednesday September 18, 2024 @12:02AM (#41575667)
Re:Swift 6 by astrange on Wednesday September 18, 2024 @12:40AM (#41575859)
Swift does have borrow checking: https://www.swift.org/blog/swift-5-exclusivity/

Basically the difference is that Swift's is more implicit, happens more at runtime, and it will make some programs work via copy-on-write that Rust would reject.

So that's obviously more limiting. It's more flexible when you can allocate memory freely, but it doesn't work if you can't.

Re:Swift 6 by dogprez on Thursday September 19, 2024 @06:32PM (#41597031)
> happens more at runtime

Bingo, that's the difference. That's why I said "compile-time memory safety". This is what Rust gives you for your trouble, zero (runtime) cost for memory safety.