New in C#4
bearophile
bearophileHUGS at lycos.com
Wed Oct 29 07:37:25 PDT 2008
Thanks to Reddit I have found a nice short document that lists some of the differences of C#4:
https://docs.google.com/View?docid=dcj4xk6_17ffc7nmgv
They have added a dynamic invocation, useful if you want to implement a dynamic language (like IronPython, IronRuby, etc) on top of the dotnet. Object-C shows this is doable in a very C-like language, and the Boo language shows that in a statically typed language it can be useful to use a Duck type once in a while to reduce the "static type pressure". More info on this last concept in the Boo site.
Something that I like a lot is the named arguments, that I hope to see in D and Delight someday. They are used often in Python, and they help increase the readability of the code, sometimes even reducing mistakes.
They have used colons:
foo(x: 1, z: 3)
While Python uses equal signs:
foo(x=1, z=3)
I think they are about equally readable.
(I think there's a problem with named arguments, that you can solve in some ways, for example with an extra hidden bitfield argument that encodes what arguments are given and what not).
Bye,
bearophile
More information about the Digitalmars-d
mailing list