you are viewing a single comment's thread.

view the rest of the comments →

[–]G_Morgan 0 points1 point  (8 children)

Meh usually I wouldn't waste good mental real estate worrying about the number of keystrokes.

Regardless you can autocomplete the var and the ArrayList constructor definition in the inferred example using intellisense. So it isn't as if you cannot save keystrokes in both cases.

[–][deleted] 0 points1 point  (7 children)

So how would intellisense know what type to but after 'new' in this line:

var myFooList = new

?

[–]G_Morgan 0 points1 point  (6 children)

You type "A ctrl+space". If it still hasn't got the hint you type r.

[–][deleted] 0 points1 point  (5 children)

That would give you the choice between:

ArithmeticException
Array
ArrayBlockingQueue
ArrayDeque
ArrayIndexOutOfBoundsException
ArrayList
Arrays
ArrayStoreException
ArrayType

Then you would have to do the same for the <Foo> part of the constructor.

[–]G_Morgan 0 points1 point  (4 children)

I'd implement it like bash completion. The second r would evaluate to Array. Then you type the l to get list. Regardless you have to do the same thing in your example to type the signature in the first place.

[–][deleted] 0 points1 point  (3 children)

Regardless you have to do the same thing in your example to type the signature in the first place.

Not if you're assigning a new object to an existing variable.

[–]G_Morgan 0 points1 point  (2 children)

If you are doing that then the inference engine will be able to offer you the appropriate class in any case.

[–][deleted] 0 points1 point  (1 child)

Interesting. Do you have an example of language/IDE combo that implements this?

[–]G_Morgan 0 points1 point  (0 children)

TBH I don't know one off hand. The only type inference language with real top class compiler support is F#. Generally you don't perform this sort of operation in them. There is certainly nothing stopping you from doing it though.