Hacker News new | past | comments | ask | show | jobs | submit login

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?



Well, 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.


The 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.


The computer can indeed find out. Most statically typed language can infer types nowadays.


Python has this: https://github.com/google/pytype

"Pytype checks and infers types for your Python code - without requiring type annotations."




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: