4 ms·
This is true of java and c as well. You can cast things or subvert the type system and the code will still run. At least where I work, my build process preven
by joshuamorton 7y ago
This is true of java and c as well.
You can cast things or subvert the type system and the code will still run.
At least where I work, my build process prevents me from running Python code with invalid type annotations, so it's exactly the same as for Java is cpp or any other statically typed language.
- nurettin 7y agoIn my opinion, the main difference between the two from a developer's perspective is this; You can't grep for dynamic type errors. You can grep for a cast to see where you've made a mistake and find a way to do it without a cast. This of course goes for the named casts in C++. It is harder to grep for casts in C.
- joshuamorton 7y agoRight, but if you run mypy over your code, you're in the same situation as in java. It's a one liner to run mypy before you invoke your tests. You have to cast to subvert the type system. In c you have void ptr everywhere anyway.