← Back to context

Comment by corethree

2 years ago

It's not about incompatibility it's about safety. You drive with air bags or you don't, those two concepts are NOT about incompatibility. It doesn't even make sense.

If there are situations where you have no choice but to drive without airbags, those are holes in safety.

Essentially if you have to have runtime checks to prevent the program from full on crashing those are holes. Not everything is checkable with static checks but the way to go is to move as much of your code away from runtime checks as much as possible.

Not sure I understand your point, there will always be runtime checks in any non-trivial application. Typically these will be for things outside of the code, for example: network status, file access, user input, external input (think JSON parsing), hardware requirements, etc

So for opening a file for example, using try/except instead of checking if the file exist and is readable first.

Both achieve the same results but the first is more "pythonic".

My point is that this way of writing code is not at all incompatible with using a type checker for said code.

  • >My point is that this way of writing code is not at all incompatible with using a type checker for said code.

    I'm saying "incompatible" isn't even a relevant concept here. Here's an analogy:

    You're telling me that running with shoes is compatible with running without shoes thus I can run with one shoe on one foot and the other foot is barefoot.

    The goal is to objectively put shoes on both feet. Sometimes you're missing a shoe so you have no choice. But this has nothing to do with "compatibility" it's a completely different thing.

    We are getting a bit into pedantic territory here, but THAT was my point and I am simply clarifying it because you MISSED the point.