Hacker News new | past | comments | ask | show | jobs | submit login

Not sure why you are using lambda syntax instead of defining a method shrug, but anyway I don't think the type inference shortcoming is inherent to static typing.

See this similar post regarding type inference on fields: http://blogs.msdn.com/ericlippert/archive/2009/01/26/why-no-...

I'm sure there is an equally reasonable explanation of costs and implications for your example. Eric Lippert would probably be happy to share it with you, why not ask him? :-)




You're right, statically typed languages can use type inferencing; both Haskell and Ocaml do.


I'm sure there is an equally reasonable explanation of costs and implications for your example.

There sure is. Had I defined a method (like you suggested), and just gone ahead and made my function variable point to that, the compiler would have enough information to infer types. In that case I would get away with the following:

  var someFunction = (X) => entropy(X);
Just felt like contributing somethings which isn't on the HN daily list of languages, that's all :)




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

Search: