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

This is called automatic type inference, and it is a big feature of functional programming languages, many of which are very strongly typed. Also, for the record, C++ gained type inference about a decade and a half ago.

In C++ one can declare a completely typeless lambda:

  auto callsAdd = [](auto x, auto y) { return x + y; }
And the programmer need never specify what x and y are, as long as there exists a reachable declaration of operator+ that has two arguments that accepts whatever x and y resolve to, at instantiation time (which is compile time).


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

Search: