|
|
|
|
|
by thelazydogsback
3338 days ago
|
|
I think the code is much more readable and less annoying with inference. And as for your examples, you don't need to know the types - the compiler will complain if you try and use them inappropriately whether the type was explicit or not. But the issue you have glossed over is that sometimes there is no nominal type - there is only an anonymous type, as for example returned by a LINQ query using new{}, or via monad-style combinators where you really don't want to see the type for fear of your eyes bleeding. |
|
I concur. I've been dabbling with Java a bit again (mainly because of a hobby project in order to learn Clojure) after a pause of multiple years.
It boggles my mind that compiler inference didn't make it into the language yet. Everytime I have to declare a totally obvious type, I cringe.