Re: question on anonymous type
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Sat, 7 Jun 2008 07:08:06 +0100
Arne Vajhøj <arne@xxxxxxxxxx> wrote:
I'm sure they'll survive - they just may not be as productive.
I doubt it.
It has been discussed as a new feature for Java and it is nowhere
near the top of the popularity list.
That doesn't mean it won't prove to be useful in C#. People often
underestimate how useful a feature will be when they haven't had it.
Look up Blub's Paradox.
The problem with redundancy isn't the possibility for inconsistency -The possibility of inconsistency is the classic reason to avoid
it's the lack of information density. It takes more space redundantly
specifying information, so there's more to wade through when reading
the code.
redundancy.
In many other scenarios, yes. Not here.
Disk space is cheap.
Who was arguing that disk space was relevant?
You said that it takes more space.
I was talking about *visual* space. *That* is important - disk space
(for source code) generally isn't.
And I find it hard to believe that the usage of var instead of
explicit classname should take longer time to read.
It changes the emphasis of the code. Eric Lippert puts it well:
http://csharpindepth.com/ViewNote.aspx?NoteID=61
I think it is the other way around.
X o = new X();
emphasizes the what and not the how.
First you read that you have an o of type X.
Then you may or may not read where you got it from.
var o = new X();
First you read that you have an o without more info and
then you has to read where it came from to figure out what
it is.
No, you're missing the point - with var, you tend to concentrate on
what you *do* with o rather than the exact type of o (which is part of
the "how").
--
Jon Skeet - <skeet@xxxxxxxxx>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
.
- Follow-Ups:
- Re: question on anonymous type
- From: Arne Vajhøj
- Re: question on anonymous type
- References:
- question on anonymous type
- From: timor . super
- Re: question on anonymous type
- From: Arne Vajhøj
- Re: question on anonymous type
- From: Jon Skeet [C# MVP]
- Re: question on anonymous type
- From: Arne Vajhøj
- Re: question on anonymous type
- From: Jon Skeet [C# MVP]
- Re: question on anonymous type
- From: Arne Vajhøj
- Re: question on anonymous type
- From: Jon Skeet [C# MVP]
- Re: question on anonymous type
- From: Arne Vajhøj
- question on anonymous type
- Prev by Date: Re: C# equivelent of VBA "with..end with" statement
- Next by Date: Re: C# equivelent of VBA "with..end with" statement
- Previous by thread: Re: question on anonymous type
- Next by thread: Re: question on anonymous type
- Index(es):
Relevant Pages
|
Loading