←back to thread

311 points melodyogonna | 1 comments | | HN request time: 0s | source
Show context
lordofgibbons ◴[] No.45143335[source]
I'm the primary target audiance for Mojo and was very interested in it, but I just wish they didn't keep Exceptions. This backwards compatibility with Python syntax is extremely overrated and not worth the cost of bringing language warts from the 90s.

God, I hate exceptions so much. I have never seen anyone use exceptions correctly in either Java (at FAANG) or in any regular Python application.

I'm much more in favor of explicit error handling like in Go, or the syntax sugar Rust provides.

replies(2): >>45144494 #>>45145537 #
UncleEntity ◴[] No.45144494[source]
Which kind of begs the question: what it the correct way to use exceptions?

Like, python says to throw an exception when an iterator reaches the end so if my custom C iterator does that is it wrong? I do kind of want to be able to do the whole 'for i in whatever: do(stuff(i))' thing so...

replies(1): >>45145376 #
1. rybosome ◴[] No.45145376[source]
Not the OP, but I assume they mean that it's encoded in the type system.

For example Rust gives you a `Result<Thing, ErrorType>`, which might be a `Thing` or might be one of the possible error types given by `ErrorType`. So when you get a function's return value, you have to deal with the fact that it might have failed with this specific error.