Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are different degrees of type inference. Go's `:=` operator and C++'s `auto` keyword use the simplest kind, where the right-hand side must evaluate to a concrete type. More powerful than that are systems that can infer the type of all variables in a function scope depending on how they are used throughout the function (such as Scala and Rust, though Scala's is waaaay more advanced than Rust's afaict), but require functions themselves to always be explictly typed. More powerful still are languages with whole-program type inference such as ML, which can infer even function signatures.

(Please note that I'm very rough on approaches to type inference, corrections to the above are welcomed!)



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

Search: