Ben Holmes @bholmes.dev · Dec 19

When it comes to error handling, Swift is what JavaScript should've been. Here's why!

21 likes 3 replies

?

Replies

Mark Malstrom · Dec 19

That last part is incorrect. Swift introduced typed throws at WWDC 2024

Pearce Keesling · Dec 19

Isn't this basically java's checked exceptions? Also you should check out error types coming soon in kotlin, very similar idea but uses union return types instead of throwing (more akin to Result in Rust or multireturn values in go minus the problems)

Eva Ogbe · Dec 19

At this point I'm convinced that modern languages should not have exceptions. Exceptions are just fancy goto. A language should depend on returning an error tagged union and have some syntactic sugar for early return of an error type. Rust and Haskell get this right.