Re:Things You Should Never Do, Part I (2000)
by dllthomas on Wednesday September 04, 2013 @11:46AM
(#6328350)
Interestingly, this (narrow) case is supported by C++ (auto) now.
Even C, kind of:
#define AUTO_TYPE(X,Y) __typeof(Y) X = Y
... though I'm not sure I'd recommend it.
Type inference in full generality can give you a bunch more, as I just went into over here: https://news.ycombinator.com/item?id=6327327
val object = MyObject(someOtherObject(12, "hello")) // Scala
instead of:
MyObject object = new MyObject(new someOtherObject(12, "hello")); // Java
saves a lot of time and it just looks nicer. All the while retaining the advantages that static, strong typing have (great potential for refactoring, a lot of errors can't happen at all). Of course, there are some things that will still take up more space than they do in Python or Ruby but it's a great improvement. Languages like Rust, Scala or C# also have a good variety of functional programming tools that can make your life a lot easier.