4 ms·
No it isn't. Semantics matter, and using something against the defined semantics of the language is a huge code smell. For example, I could ignore the fact tha
by usrbinbash 2y ago
No it isn't. Semantics matter, and using something against the defined semantics of the language is a huge code smell.
For example, I could ignore the fact that Python has exceptions, and instead let functions return error values.
Would that work? Yes, absolutely, and I have seen Py-Codebases that do this.
Is it semantically correct? No, because in python, semantics dictate that error states are handled via exceptions, and that is the expectation everyone has when opening a python codebase.
When in Rome, do as the Romans do.
- xerokimo 2y agoThat's being idiomatic to a language, not being semantically correct. Result, Either, Expected, all have different names, but their semantics are all the same. Panic and Recover may not be idiomatically used the same way Exceptions are used in other languages, but they share the exact same semantics of implicitly bailing out potentially multiple functions, going up the call stack until we Catch, or well Recover.