Linked by Eugenia Loli-Queru on Wed 8th Mar 2006 18:13 UTC
.NET (dotGNU too) C# 2.0 is just out and Microsoft is already working hard on the next version of C#, version 3.0. In this post, Niek describes a few of the new language features that will be introduced in this version. Please note that the resulting binaries will be backwards compatible with .NET 2.0, so C# 3.0 is only new on the compiler side.
Thread beginning with comment 102744
To read all comments associated with this story, please click here.
var keyword
by jack_perry on Thu 9th Mar 2006 08:57 UTC
jack_perry
Member since:
2005-07-06

I can see how the "var" keyword can save time during programming.

However, one hopes that a piece of code is written only once. After that, it has to be maintained, modified, upgraded, etc.

For the life of me, I can't see how "var" does not hurt the maintainance of code. I agree completely with those who say it makes the code less readable.

Even if it is designed for a special circumstance (LINQ), and even if it is immensely useful for that purpose, people are now presenting it as a general-purpose construct that saves the creator time.

If this is the situation now, imagine the result when abuse sets in.

Am I wrong?

RE: var keyword
by renox on Thu 9th Mar 2006 12:07 in reply to "var keyword"
renox Member since:
2005-07-06

That's hard to say, I think that var will make code shorter to read so this should help maintainability.

Now OTOH, there could be instance where a type error could be hidden due to var so it could also reduce maintainability. But with *local* type inference I expect that those case will be rare.

IMHO this is a plus, unfortunately Limbo, Scala (other language where there is local type inference) programmers are rare so it's difficult to get a feedback.

Reply Parent Bookmark Score: 1

RE[2]: var keyword
by _LH_ on Thu 9th Mar 2006 12:14 in reply to "RE: var keyword"
_LH_ Member since:
2005-07-20

>That's hard to say, I think that var will make code shorter to read so this should help maintainability.

I can see one case where this doesn't hold. Something like

var variable = ueberMega31337Function( arg1, arg2, ..., argn );

Tell me what kind of a variable does that return without searching for that functions definition.

Reply Parent Bookmark Score: 2