4 ms·
“Local variable type inference” is a bit unwieldy of a term. Your conclusion is the same as mine. Use them when appropriate. When is appropriate? We need some
by azhenley 7y ago
“Local variable type inference” is a bit unwieldy of a term.
Your conclusion is the same as mine. Use them when appropriate. When is appropriate? We need some data on that.
- maxxxxx 7y agoThis is highly personal. Best would be to have an IDE that shows the concrete types if desired by the user. In VS you can hover over a variable but permanent display would be nice too
- azhenley 7y agoRunning experiments would give us data on whether it is personal or not, and to what degree. I know a lot of teams that conduct code reviews outside of the IDE, so your suggestion wouldn’t help those cases.
- insertnickname 7y agoIntelliJ shows hints for inferred types.
- Quekid5 7y agoAs a data point: I use Scala + IntelliJ and I've personally actually turned this off. If you have a half-way decent type system I tend to find that it just gets in the way -- at least if things have reasonable names. (This is obviously a very personal preference and depends on whether it's a code base you're already familiar with, etc. etc.)
- Quekid5 7y agoWhile I agree with the desire for experimental data, you're assuming that the status quo[1] is the right answer. There's no evidence that it is -- the reason it wasn't mainstream until recently was mainly fear of going against the status quo. ML and Haskell, for example, have basically had (local and hear-global) type inference since the 1980s. [1] As of, say, 2009 or so where even local type inference was relatively rare in mainstream languages.