Re: question on anonymous type



Jon Skeet [C# MVP] wrote:
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.

I don't think that apply very well. A rather big percentage of Java
programmers also program in C#.

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").

But what I do with o.m() actually depends on what o is !

Arne
.



Relevant Pages

  • Re: inheritance vs. composition involving generic classes
    ... Something of the sort "Here's how to implement this C++ ... feature in Java and here are some things you can do in Java but not in ...
    (comp.lang.java.help)
  • Re: How does this make you feel?
    ... > [listing system programmers, app programmers, end users] ... bug and feature since they are sometimes synonymous. ... > Bugs that are visible all the way up to the end user: ... > 1% because the big limiter is memory latency. ...
    (comp.arch)
  • Re: Rene is a hypocrite (OK, what else is new?)
    ... I dont know any avarage programmers. ... RosAsm doesnt detect it. ... But AoA is no longer very useful, unless HLA is involved. ... The right click feature is espesially nice in a monofile architecture. ...
    (alt.lang.asm)
  • Re: Reddit Guys on the Pros and Cons of Lisp
    ... >> I never have to do that with Java. ... > language features, etc. ... They either have the feature or they don't. ... > libraries doing almost the same - for those languages. ...
    (comp.lang.lisp)
  • Re: 7.0 wishlist?
    ... The primary purpose of unchecked conversions is to facilitate migration to generics at disparate times. ... Operator overloading is principally used for mathematical constructs. ... It is not the job of the language designer to enforce against every conceivable misuse of a language feature, least of all to do so by simply refusing to add any features at all for fear that they might otherwise be abused. ... it is difficult for Java to not have chosen C++ syntax for various reasons. ...
    (comp.lang.java.programmer)

Loading