Comment

Comment by jkelleyrtp

Swift 6 is amazing - I say this as a big Rust person. It seems like Swift is now its own entity outside the Apple bubble and has a few very interesting features:

- An "embedded" mode that turns off reflection for kilobyte-sized binaries

- An upcoming WASM target

- An LSP for VSCode

- Native C++ interop

- Typed "throws"

- Static linking on linux and the linux sdk

- Porting a number of "core foundation" / foundation primitives to nix platforms

- Distributed actors for concurrency that run on distant machines

- Data-race free by default

- non-copy RAII generic types

Watch the video on Swift 6: https://developer.apple.com/videos/play/wwdc2024/10136/.

IMO Swift 6 is a better Go and than Go, and a better Rust for app-dev type stuff, which seems to be what people want to use Rust for.

Swift has shipped stuff that Rust has been sitting on its hands over for years:

- Anonymous enums/structs in parameters/match statements

- Named function arguments

- A type of `Send` bound that allows Rcs to be sent between threads (not Arcs)

- Swift preview hotreloading

- autoclones (without GC)

Swift also took a bunch of goodies from Rust *[1]

- No garbage collector

- Traits via "protocol"

- ADT for Option/Result

- macros

- non-copy types enforcing RAII

I really really wish Rust had been keeping up with Swift's ergonomics because it's looking like Swift is going to catch up to Rust's cross-platform story much faster. Swift really could end up as the "do it all" language for frontend/backend/app dev.

[1] By "took" I mean if you like these things in Rust you'll see them in Swift

parent jkelleyrtp 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton