44
Python errors as values (www.inngest.com)
submitted 10 months ago by mac@programming.dev to c/python@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] Knusper@feddit.de 6 points 10 months ago

Yeah, at $DAYJOB, we switched (regrettably) from Scala to Kotlin and wanted to continue using the errors-as-value style, which I was the biggest proponent of. However, there not being a way to make the Kotlin compiler shout at you, if you implicitly ignore a return value, really made me question that choice.

It means that if you refactor a function to now be able to fail, then you have to go to all usages and make sure you continue the bubbling.

With exceptions, you should also do that, to potentially introduce try-catches, but if you don't, then it will at least crash very visibly.

If the compiler does shout at you, like in Scala and Rust, then I think, that's a better pattern.

[-] Schmeckinger@feddit.de 2 points 10 months ago

Especially when you tell the compiler to treat unhandled error types as error instead of warning.

this post was submitted on 14 Nov 2023
44 points (94.0% liked)

Python

6174 readers
33 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

October 2023

November 2023

PastJuly 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS