Hacker News new | ask | show | jobs
by linsomniac 308 days ago
>typos no longer crash in production because the compiler checks everything.

Gentle correction: Python is typed now too and you can get the benefits of typing both in your IDE (via LSP) and before deploying to production (via mypy and the like). This happens both by type inference as well as explicit type annotations.

7 comments

That's the dream. Reality is very different. Mypy presents numerous false negatives and false positives. Useful to screen for some bugs, but definitely far from giving guarantees.

Not to mention, if a library does not or does sloppily use type annotations, you would not get reliability even with a perfect type checker.

Sure but you can also write bugs in a perfectly typed compiled language. Short of formal verification the best we can do is try to minimise the possible surface for errors to occur. I'm of the opinion that language and tooling plays only a small part in writing robust software. What's more important is designing software using simple components that are small enough to be obviously correct.
I'm sure you're right that there are situations where mypy or ty or LSP give false positives/negatives, but in my use of them over the last ~6 months I really haven't run into many of those situations, or at least none come to mind. Libraries without type annotations do reduce the effectiveness to just what can be inferred by the type checker.
you need to work on big project for these flaws to become a problem. Say, you have a huge code base, 100000's of lines that you didn't write. Then you want to refactor a method's name. Python can't give you any guarantee the refactoring is fully complete. Only a real typed language can do that.

I write 95% of my code in python, I love it, it's my go to language for many things. But for huge code base which I don't master, the lack of type system makes me more than nervous.

"Is typed now" is false.

"Can be typed now" is somewhat correct.

"Can be partially typed now" is actually correct.

> Gentle correction: Python is typed now too

No it's not and you should lose your union card for lying like this.

Take a deep breath
What percentage of typing features does a language need to have to be "good enough"? Because I'm gaining benefits of typed languages in Python, but responses to this thread are, literally: You aren't a programmer.
The fact that you have to run a separate tool just to check typing is a joke.
True but IME languages that are historically dynamically typed have a rough time truly converting to static types.

Php even seems to have decent static types these days, but do my coworkers use them? Hell no

Somehow "gentle correction" sounds more aggressive (passive aggressive) than just saying correction.
It's patronizing.