News for hackers. Stuff that matters.
Re:Swift is a more convenient Rust by thomassmith65 on Saturday January 31, 2026 @07:47PM (#46842515)
It's been a while, but the one I remember with the most horror was dealing with Enums, and Enum payloads. Since Swift is statically-typed, many 'type union' situations end up becoming difficult problems. The question usually boils down to thinking about choosing one of (a) Enum with Payload (b) Generic (c) Type erasure. Nearly anything technically is do-able, but I wasted many hours (ie: repeatedly, not until I figured out the 'right way' for every situation) deliberating over how!
Re:Swift is a more convenient Rust by saagarjha on Sunday February 01, 2026 @04:43AM (#46844864)
Low level languages don’t even have those features.
Re:Swift is a more convenient Rust by thomassmith65 on Sunday February 01, 2026 @08:26AM (#46846063)
I didn't mean to suggest they do!

When I used Swift, I frequently was surprised to find some simple part of a program actually required me to sit and plan for several hours.

The exhausting amount of mental energy is the only part that reminds me of coding in Assembly.

Re:Swift is a more convenient Rust by saagarjha on Sunday February 01, 2026 @06:17PM (#46850387)
I guess my perspective is that I usually have to plan out my programs regardless of what language they’re in so I don’t really view it as being similar?
Re:Swift is a more convenient Rust by thomassmith65 on Sunday February 01, 2026 @11:45PM (#46852504)
That is a different issue than this:

  I frequently was surprised to find some simple part of a program actually required me to sit and plan for several hours.
It's perfectly normal in programming to encounter domain problems that take longer than one predicted, or to plan ahead with pseudo code, proofs of concept, class diagrams, etc.

What is abnormal is, over and over again, to find oneself utterly stumped on how best to implement something very basic. At least, it's abnormal when using a high-level language.

Re:Swift is a more convenient Rust by whatis991 on Sunday February 01, 2026 @05:10AM (#46845011)
I am not sure that I understand you correctly, and I find the subject interesting.

Is it what the enum abstraction can model easily that is the issue?

If so, I believe the Rust community has similar issues regarding error handling. There are multiple libraries like thiserror and anyhow.

https://old.reddit.com/r/rust/comments/1mexsqr/the_way_rust_...

https://old.reddit.com/r/rust/comments/1q3wb3l/stop_forwardi...