4 ms·
The opposite for me. Typing makes zero sense. I know what I'm doing with my variables so why do I need to specify a type? Why can't the computer figure this out
by pbreit 6y ago
The opposite for me. Typing makes zero sense. I know what I'm doing with my variables so why do I need to specify a type? Why can't the computer figure this out? Isn't that what computers are good at?
- masterofmisc 6y agoWell, as the author of the code, you should be able to tell the function what type of variable you expect (string, int, or business entity e.g Book, Bookstore). That way if you later try to call the function passing an int when it expected a Book, you have an early warning system at compile-time. Not run-time.
- rowanG077 6y agoThe computer can indeed find out. Most statically typed language can infer types nowadays.
- willcipriano 6y agoPython has this: https://github.com/google/pytype https://github.com/google/pytype "Pytype checks and infers types for your Python code - without requiring type annotations."
- eropple 6y agoThe evidence from a whole lot of code written by a whole lot of people seems to indicate that, for the most part, a given developer actually may not know "what [they're] doing with [their] variables". For everything else, there's type inference.