
Get Ready For C# 4.0 - ronnier
http://blogs.msdn.com/csharpfaq/archive/2010/04/12/get-ready-for-c-4-0.aspx
======
urza
<http://channel9.msdn.com/pdc2008/TL16/> Although from 2008, this is still an
interesting talk from Anders Hejlsberg - the lead architect of the C#
programming language. He outlines the future (now mostly present) of C# and
describes the many forces that influence and shape the future of programming
languages and explain how they fit into C#.

In the end he talks a little bit about what is beyond 4.0 and he demonstrates
the "compiler as a service", which is something I am looking forward to see :)
In fact guys from Mono already moved things forward a little bit:
<http://www.mono-project.com/CsharpRepl>

I like where this is heading.

~~~
pbz
Here's a more recent one: [http://channel9.msdn.com/posts/matthijs/Anders-
Hejlsberg-Tre...](http://channel9.msdn.com/posts/matthijs/Anders-Hejlsberg-
Trends-and-Future-Directions-in-Programming-Languages-DevDays-2010-Keynote/)

~~~
urza
Thanks.

------
motters
I have written a fair amount of C# code, although not so much recently. I
think Microsoft are in danger of crowbarring too much into this language.
Ideally I think they ought to start looking at rationalising and simplifying
the syntax rather than adding ever more stuff to it.

~~~
TeHCrAzY
There isn't a great deal of actual "new" features. Alot of the fixed, such as
"IEnumerable<Object> objects = new List<String>();" are just filling out gaps
in implementation. I have a large amount of just written code that is dying
for the above feature, not to mention optional+ named parameters!

------
statenjason
We switched over in our shop on release week, and I must say that I'm enjoying
the new features of .NET and C# 4.0. COM interop with Office Communicator is
cleaner. IronRuby + Sass for css with ASP MVC rocks. Optional parameters have
killed off many pass-through overloads. Also, DynamicObject and
IDynamicMetadataProvider give potential for the dynamic keyword goes far
beyond ExpandoObject. It opens up possibility for new DSLs within C#. Although
likely to be misused, having the power to manipulate the meaning of the
language is an impressive feature.

------
kolektiv
Have we not been getting ready for C# 4 for some time? It's been in CTP and
Beta variants for most of the last year. Some good new features exist of
course.

~~~
javery
This article is also a month old.

------
flatline
I'm not sure I like the overloading of the "out" keyword for covariant type
parameters, but otherwise, pretty cool.

~~~
SanjayU
Yeah, I'm not a huge fan of named parameters, either. Seems a bit superfluous.

~~~
j_baker
Named parameters make code more readable when used properly. For example,
which is more readable?

    
    
        var c = new Cube(1, 2, 3)
    

or:

    
    
        var c = new Cube(height: 1, width: 2, depth: 3);

~~~
InclinedPlane
The real advantage of named parameters is the ability to have optional
parameters as well. Which means that instead of:

    
    
       var c = new X(3, "blue", null, null, null, null, false, true, null, 1, null);
    

(which, sadly, is an all too common implementation pattern), you can have:

    
    
       var c = new X(foo: 3, bar: "blue", baz: false, quux: true, wibble: 1);
    

Which seems quite a bit better.

Another advantage of named/optional parameters is that you can use them in the
construction of immutable objects, whereas you don't get that advantage if you
use settable properties.

------
jacquesm
I think I'll pass.

I've passed on anything coming out of microsoft since about 2003 or so, and I
feel much better for it. No more stacks of MSDN cds, no more 'support events'
and so on.

No more viruses, worms, trojans, piles of malware and other nonsense, besides
license fees, subscriptions to stay up-to-date, re-installs every 3 to 5
months.

Open source all the way for me these days, and I feel _much_ happier for it.

It's possible that C# is a great language and that I'm missing out on
something that would improve my life in a way that I can not currently imagine
but there always seems to be a price for that.

~~~
jorgecastillo
It's a shame some HN users down vote people just because they disagree with
their opinion. I didn't seen anything in this comment that would be considered
offensive to anyone. I didn't even see any FUD.

Can any of you really disagree with "No more viruses, worms, trojans, piles of
malware..."? In all the time I have been using Linux (OpenBSD now) I haven't
had this sort of problem. I am not saying this systems are invulnerable. But
OSS/*NIX system users will probably not have this sort of problem and even if
they do it won't be as often as Windows users.

P.S. Maybe the title attracted only Windows and C# people?

~~~
stonemetal
Perhaps because I have used windows for about 20 years now and never had piles
of malware. I have never reinstalled the OS. I have never paid license fees,
subscription fees etc. It is almost as if he were living in an alternate
reality from the one I inhabit.(Note I have been dual booting Linux for around
10 years. I like both sides of the fence.)

Two all is comments are about Windows OS not a single one about C# which is
presumably the topic at hand.

~~~
jacquesm
I've used microsoft products from before 'DOS' was even around, and I quit
around 2003. I would have quit earlier but I still had to support a bunch of
stuff that was running on windows (the webcam.exe client side stuff to connect
to our websites), and a bookkeeping program that was windows only.

I've had to re-install machines numerous times because they became unusably
slow or infested with malware. We had _one_ machine to which this never
happened, nobody really understood what made it different from all the other
ones (as much as 25 machines at a time at some point), that little machine
just kept chugging away. Maybe it needed an occasional reboot, but even that
must have been rare because I don't recall ever having to do that. It's not
like it was build with premium components either, it was mostly built from
leftover bits and pieces.

I was a licensed MSDN developer for a long time, it cost a pretty penny.
You've never paid license fees ? Ok, that's your decision, I always paid for
the ones we used, in fact I probably paid for plenty that I didn't use (aka
the microsoft tax).

For the most part though, windows was nothing but trouble for me and the
people that I worked with, and since switching to linux I haven't had any
experience even remotely comparable to what used to be my lot when still using
windows.

The machine I'm writing this on was bought in December, the 'vista'
installation that came with it was wiped and replaced with Ubuntu. It's a fair
sized machine, 10G of ram and an i7 processor, this is still the first logged
in session on that machine since I got it. That's amazing stability. It's
possible that microsoft has comparable stuff now but I won't be seeing any of
it until I either absolutely have to or they do something unthinkable today to
prove that they really get it. (Such as, for instance really opening up the
source to windows or some earth shattering move like that).

I'm happy you're happy with either, I'm more happy with FOSS stuff, it feels
like it is a more natural and democratic approach to computing than having my
capabilities granted and removed by some corporation, especially one that has
been a bad little boy in the class of corporations.

~~~
stonemetal
_You've never paid license fees ? Ok, that's your decision, I always paid for
the ones we used, in fact I probably paid for plenty that I didn't use (aka
the microsoft tax)._ Any copy of windows I have came with the machine, so I
have never directly paid license fees(as far as the Microsoft tax goes Dell
seems to charge the same for its Linux boxes). As a developer I have always
used the other guy(borland and watcom mostly.)

 _this is still the first logged in session on that machine since I got it.
That's amazing stability._ Not sure what to say about that, I have only
rebooted Windows after applying system updates for as long as I can remember
but then I mostly turn it off when I know I am not going to use it for a few
hours so I have never had a large uptime.

That still doesn't address the fact that this is entirely off topic as Windows
OS != C#. My entire use case for C# is as the scripting language for Unity3d
which is based on mono since it is cross platform capable.

------
frou_dh
Buh... I haven't read Jon Skeet's C# In Depth for C# 3.0 yet. Can I pass?

~~~
solutionyogi
I haven't read C# In Depth for 4.0 yet, but I would suggest that you should
not pass on the 3.0 version. Here's why.

C# In Depth is not like a technical reference book where the author rehashes
the same information what you can find on your own at MSDN. Jon discusses the
evolution of language starting from C# 1.0 up to 3.0. I sincerely wish that
all technical books were written like this. If you are still not convinced and
want the cofnirmation from someone more authoritative, let me point you to
Eric Lippert's forward for the book.

[http://blogs.msdn.com/ericlippert/archive/2008/04/28/c-in-
de...](http://blogs.msdn.com/ericlippert/archive/2008/04/28/c-in-depth.aspx)

Eric Lippert is a senior developer on the C# compiler team and his blog is a
must read for all C# developers.

Coming to the main point, my __guess __is that Jon may be skipping on some
details in the new version of the book which he has already covered in the
current version. And I think it would be great idea to learn about the
choices/compromises made by the language designers.

Good luck.

~~~
frou_dh
Thank you. It occurred to me that it would be nice if the pre-generics
artefacts were somehow erased from history. (They're essentially clutter in a
space that's getting fuller and fuller, right?)

------
bfung
The funny thing I come back to question myself with after seeing ExpandoObject
and not needing to declare types (var blah = ), is, why not just go all the
way to Ruby instead of being stuck inbetween?

~~~
sid0
Because static typing is really, really useful?

~~~
bfung
ExpandoObject basically says you can add properties ad hoc. When that happens,
how do I know when a property on the object exists or not? The value of static
typing goes down with ad hoc properties.

~~~
mquander
Sure; if every object was an ExpandoObject, the value of your "static typing"
would be nil. The point is that you can just make an ExpandoObject if you
really need ad hoc properties in one place, and it cooperates with the rest of
your statically-typed code.

To illustrate the value of such a thing, I invite you to look at the ADO.NET
libraries for data access, which provided a verbose, painful "dynamic property
bag" experience as far back as .NET 1.0; you had DataTables with columns that
you would pass a type to, and then you had DataRows that you indexed into with
strings to put objects in and get them out, and you had to cast them back and
forth as you did it -- all of it ugly, none of it checked at compile-time. The
value of C# dynamic (besides interop) is that now you can have such a thing in
a fairly concise form with syntax that doesn't make you sob uncontrollably
when you use it.

~~~
TeHCrAzY
And people do use it. I have worked on a mind bending .NET call centre
application within which the entire state of the program is stored within
untyped, globally accessible datatables.

It's down to the old "with great power comes great responsibility" idea.

------
preek
My 2c on that topic: <http://blog.dispatched.ch/2010/05/10/c-40s-dynamicity/>

