this post was submitted on 14 Nov 2023
43 points (93.9% liked)

Python

6347 readers
2 users here now

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

๐Ÿ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

๐Ÿ Python project:
๐Ÿ’“ Python Community:
โœจ Python Ecosystem:
๐ŸŒŒ Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] Knusper@feddit.de 6 points 1 year ago (1 children)

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 1 year ago

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