5 ms·
Modern statically typed languages (cough cough not Java cough) generally have static type inference, which removes a lot of redundancy from the code. Being able
by GyrosOfWar 13y ago
Modern statically typed languages (cough cough not Java cough) generally have static type inference, which removes a lot of redundancy from the code. Being able to do
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.
- dllthomas 13y agoInterestingly, 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 https://news.ycombinator.com/item?id=6327327
- sebcat 13y agoJava 8 will have static type inference, and some other goodies too.