Hacker News new | ask | show | jobs
by cm2187 3030 days ago
On your point about the IDE helping you, there are two use case.

object i = new object();

I agree you only type once, the IDE will suggest object after new. But in that case the type is needlessly redundant, var could be use without making the code any less readable.

object i = myfunction();

Here the object is sementically useful but given that you have to type it before you type the name of the function I don't see how the IDE can possibly help you. Not only that but unless you know the return type of that function by heart it forces you to go check it out before you even start the line. And if you are using generics (or valuetuples) that could be a long type name.

1 comments

For case 2, a modern IDE like IntelliJ has completion suffixes. So you can type:

myfunction().var<TAB>

and it would expand to

object i = myfunction();

where i would be highlighted so you can immediately type the name of the variable and when you press enter the cursor is placed after the completed statement.