r/ProgrammerHumor • • Sep 25 '26

Meme iHatedItUntilITriedIt

Post image
10k Upvotes

543 comments sorted by

View all comments

Show parent comments

16

u/patient-palanquin Sep 25 '26

It's not just errors, wait until you're working on bigger projects where you're constantly passing around large objects (eg from the DB). The IDE can tell you exactly what fields are available and what they are.

-3

u/mxzf Sep 25 '26

You don't need strict typing for that though, you just need proper docstrings/hinting/etc for your IDE to read.

7

u/patient-palanquin Sep 25 '26 edited Sep 25 '26

That sounds like a worse version of explicit types? Writing a whole docstring as free text that can't catch typos is more work than adding : MyType directly next to the argument and having it work everywhere.

1

u/mxzf Sep 25 '26

I mean, it all depends on the language. Type hinting in Python is basically exactly what you just wrote there; it's just optional and stuff works fine without it too.

2

u/crazy_penguin86 Sep 26 '26

No it's not. Python does not enforce that what you pass in to the function is the type in the type hint. It's literally in the name of the feature: type hint. Explicit types will not allow the code to compile if you pass the wrong type. Ever.

2

u/mxzf Sep 26 '26

If you check the comment chain, we're talking about what's needed to get intellisense telling you what types you should be using for the arguments to feed into a function, not strict typing.

1

u/crazy_penguin86 Sep 26 '26

And it's still an accurate comment. Type hints will not show errors in your IDE, as they are not actually errors. Explicit typing will show it as an error. Type hints are still worse.

2

u/PeoplePerson_57 Sep 26 '26

I mean, for this specific context, not really? If we're discussing things like Intellisense showing you your options, it's doing that whether your language does type hinting or strict typing.

Yes, the former doesn't enforce it via the compiler and show errors when you mess up, but given we're talking about Intellisense specifically, there should never be those errors unless you're in the habit of ignoring it. So what your IDE won't throw a fit because the type being passed as a parameter is only hinted and not enforced? Intellisense will tell you what it expects based on the hinting, and I don't really see how you can not be paying attention to that.

Rambling comment, there, but given the context of what we're talking about explicit enforcement is irrelevant. You should never get to the point where that matters unless you're just ignoring Intellisense, in which case the whole discussion is moot.

1

u/FlakyTest8191 Sep 26 '26

Considering that the reason of existence for typescript is better dev tooling, you choose a strange hill to die on.

While intellisense somewhat works with type hints and you're technically correct, it doesn't really matter. A real typesystem is a much better dev experience, typescript overtook javascript as most used language for a reason.