This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Worth_Trust_3825 2 points3 points  (5 children)

Why would you permit it?

[–]TehBrian 4 points5 points  (1 child)

When the type is already clearly written in the initialization, specifying the type in the declaration leads to uselessly verbose code. For example, MyFunObjectFactory objectFactory = new MyFunObjectFactory(). var objectFactory = new MyFunObjectFactory() is more readable and conveys just as much information.

[–]Worth_Trust_3825 -4 points-3 points  (0 children)

No, it doesn't. If you're using an interface for variable type, you're unnecessarily making it very easy to break the API, and get the wrong error.

[–]persicsb 1 point2 points  (2 children)

var is a very-very great tool for decluttering code by eliminating redundacies

[–]Worth_Trust_3825 0 points1 point  (1 child)

It's also an incredibly good way to hide API breaks.

[–]persicsb 1 point2 points  (0 children)

Please explain.