Again, I don’t understand what you mean here.
I read elsewhere in the Julia documentation that
Exception handling in Julia is done using
try
—catch
—finally
, instead oftry
—except
—finally
. In contrast to Python, it is not recommended to use exception handling as part of the normal workflow in Julia (compared with Python, Julia is faster at ordinary control flow but slower at exception-catching).
I’m interested to learn more about this.
- If Julia doesn’t recommend the use of exceptions for handling error state which occurs in program flow, then what is the recommended method?
- I am aware that sometimes
nothing
ormissing
might be the most appropriate return value, but this should only be used when it is syntactically sensible and meaningful to do so. Put another way, you shouldn’t default to usingnothing
to indicate error state, becausenothing
means “there is no value”, it does not mean “the state is an error state”. - Hence I am slightly confused. Julia doesn’t have a
result
type (or does it?), like Rust does. The only other ways of handling error state which I am aware of from other languages are:
- Returning integer value error codes, which is what C does (this is not a good idea) and the software engineering world agreed that it is not a good idea a long time ago. (Let me know if you want an explanation for this?)
- Raising exceptions, which is what most other languages do
Can anyone share their experience relating to this?