4 ms·
I don't like nulls and I definitely appreciate discriminated unions. But WTF is wrong exceptions?! And by that I mean try/catch/finally. I wouldn't use a lan
by emorning3 3y ago
I don't like nulls and I definitely appreciate discriminated unions.
But WTF is wrong exceptions?! And by that I mean try/catch/finally.
I wouldn't use a language that doesn't have them.
The lack of exceptions in GO is just one of the reasons I hate it.
Go is a good example of what life would be without exceptions, code polluted with error handing.
- zamalek 3y agoExceptions are invisible control flow. You have no guarantees about what piece of code will execute anywhere in your codebase. I agreed with you maybe 2-3 years ago but have since done a hard 180 in that opinion after seriously using a language with no exceptions. I'm too stupid to reason about exception control flow, just like I am too stupid to do manual memory management. There are also huge differences between exception alternatives, and I definitely think more progress is possible. I also dislike how Go approaches exceptionless, but Rust does a far better job. Hare seems like it could have one of the best approaches (so far) but I haven't actually used it. Erlang/Elixir/Gleam are also something I want to try out. Allowing things to just crash and restart is definitely a different perspective worth learning about.
- emorning3 3y agoY'know what, I just took a look and I think I would like Rust-style error handling. It reminded me about one thing that I dislike about exception handing in C#, that methods don't have to declare the exceptions that they throw, unlike Java. And the thing I disliked about the Java way was declaring exceptions that would be panics in Rust. I also like that ? Rust operator for propagating errors. I've done some Erlang and I definitely like Erlang monitors. Maybe the Rust way combined with monitors would be the ultimate in error handling :-)
- Decabytes 3y agoWhat if there was syntax that was built into a language that required annotating exceptions functions that threw exceptions. That way at least you would know that an exception was possible to be thrown in a function and could handle it appropriately