Welcome to

Magenic Technologies Community Blog

Sign in | Join | Help

Aaron's Technology Musings

Who let this guy on the podium?

C# 3.0 is a Dynamic Language

There, I said it.

I hope, finally, we can start to put the old Dynamic vs Static language schizm issue to bed.  C# now is a dynamic language.  Rubyists eat your heart out (and I mean that in good fun).

Lets go down the line - things that make a language dynamic:

'Eval', or more generally, ability to construct a data structure and compile it all at runtime.

All this is possible within the Expression namespace.  While I can plug my own MetaLinq with it's ExpressionBuilder as a way to more intuitivley build an expression versus using the factory methods to do it, either way, it is clearly possible to have "Eval" style functionality within C#.  In C#, as you can in Lisp, you can write programs that write programs.  And with 3.0, you don't even have to deal with Reflection.Emit to do so.

Higher Order Functions

Lambda Expressions are part of C# 3.0 - part of what makes a where clause in LINQ able to work.  The syntax is actually pretty reasonable as well.

Implicit Typing

Gone is the requirement that you put put a formal type on everything you use.  Now, it is a good idea that they keep that requirement for public references - things that will escape the comfortable confines of your assembly - but within that, being able to use the var keyword, especially as it relates to programs where the shape of the objects are expected to change a lot, is a good thing, contributing to the dynamicness of the language.

Continuations

Anyone that has implemented an enumerator in C# 2.x knows that we have had continuations (via the yield return statement) for some time, though I do not see them used a lot in practice.  Don "COM Is Love" Box has a great post on this from 2005 talking about the concept.

Introspection

Leaving aside the reflection namespace, the fact that you can cast Lambdas to expression trees in C# 3.0 - the whole basis for what makes something like i4o possible - is demonstrating that introspection is a huge part of the new innovative stuff coming out in C#-land.

Now, it does not mean C# is dynamically typed - which is different than being a dynamic language.  There is a great whitepaper from Erik Meijer and Peter Drayton about the subtle differences there.  However, what I am saying is that the lines are almost certainly blurring when talking about the differences between static and dynamic languages.

Of course, if we really wanted dynamic typing, we could have forgotten all this semicolon nonsense and just switched to VB 5 :)

Published Thursday, August 23, 2007 3:10 PM by Anonymous

Filed under: , ,

Comments

# re: C# 3.0 is a Dynamic Language @ Friday, August 24, 2007 3:35 AM

Have you looked at F#?

By legacy, F# comes from some of the most static languages out there (Standard ML, OCaml and Haskell) but it is integrated seamlessly into .NET, giving you all of the dynamic features that you've listed and many more beyond the capabilities of C# 3.0.

Jon Harrop

# re: C# 3.0 is a Dynamic Language @ Friday, August 24, 2007 3:41 AM

"knows that we have had continuations (via the yield return statement) for some time"

are you sure ? please make research about continuations :-)

Giancarlo

# re: C# 3.0 is a Dynamic Language @ Friday, August 24, 2007 5:32 AM

Ohh good, again and again.. VB 5 does not have Dynamic typing feature.

Dynamic typing is more than that.

For example; In dynamic typing languages such as (Ruby..etc) compiler decides what type is. Finally somebody (programmer or compiler) decided variable type.

VB 5 doesn't have compiler decision.. All undecided variable types are 'Variant'.

Uordek

# re: C# 3.0 is a Dynamic Language @ Friday, August 24, 2007 6:28 AM

Once again C# is getting features many developers have already enjoyed for several years. Never ceases to amaze me how MS fanbois (tm) choose to stick with an inferior development platform.

McNaz

# re: C# 3.0 is a Dynamic Language @ Friday, August 24, 2007 7:06 AM

Jon-

I have *briefly* looked at F# - and I intend to do so more.  However, with so many new langs coming out of MSFT lately, I really have to prioritize.  On my list right now are Spec#, Boo, and IronRuby to take a deeper dive into during the fall.

Giancarlo-

I know that VB5 "dynamic" features are not what Ruby is (just try to make an expression tree - lol) - that comment was more tounge-in-cheek than anything - meant to get a rise outta ya.

McNaz-

I think perhaps we are just happy we got the features. :)  Credit where credit is due - there were other people way out in front with this.  I still remember 2000 when the mainstream choices were limited to C++, Java, or VB.  While you could try to put forth Smalltalk, LISP, or something else, if you worked in consulting at the time, you really had to go out on a limb to recommend something like that.

Anonymous

# Nice, Microsoft couldn't innovate it's way out of a paper bag! @ Friday, August 24, 2007 10:21 AM

I have to echo the above poster with regard to Microsoft basically taking what other's have created, and trying to make it look like they're on the "cutting edge"!

Java has had this for years now, Groovy anyone?

This is all smacking of desperation on behalf of Microsoft. Their culture of closed thinking is doomed to failure.

Go ahead, enjoy C-rehash...

mmmm_yeah

# re: C# 3.0 is a Dynamic Language @ Friday, August 24, 2007 10:28 AM

LINQ?  Anyone else doing that?  Where is Apple, Google, or anyone else with regard to putting set operators in the language?  I dunno, looks like innovation to me.

It is no big secret though that Microsoft, frequently, lets other people create big markets, then once it is established, goes in and tries (sometimes well, sometimes not as) to compete.  Accusing them of that is like accusing rain of being wet.

Anonymous

# re: C# 3.0 is a Dynamic Language @ Friday, August 24, 2007 6:22 PM

Want to see some Microsoft innovation? Ayende is giving em props: http://ayende.com/Blog/archive/2007/08/25/Ergonomic-Hardware.aspx

Anonymous

# re: C# 3.0 is a Dynamic Language @ Saturday, August 25, 2007 5:18 AM

>I have to echo the above poster with regard to

>Microsoft basically taking what other's have

>created, and trying to make it look like they're

>on the "cutting edge"!

They may do that, but who doesn't? Many of the so-called "cutting edge" innovations in a lot of today's products have in fact been researched in the 60-ties or even earlier. Although Ruby is not that young, it may have taken a thing or two from the research that happened back then.

For some things, Microsoft is very innovative though. Take web components; their ASP.NET framework is certainly ahead of the curve. Java for instance is just picking up the concept wit h JSF. Editors for JSF are still lacking, and 3rd party component libs have only very recently started to mature some what.

arjan

# re: C# 3.0 is a Dynamic Language @ Friday, August 31, 2007 8:46 AM

On F#: Sorry to say it, but the language is hobbled by the fact that it is apparently aimed at the Ocaml community. I was actually very interested in this language until I picked up the book and started learning it. Halfway through I realized that the headaches I was getting were due to the extremely arcane syntax. My advice - try Nemerle instead. Not only does it perform better, but it results in tighter code. AND, it perfectly bridges the OO and functional worlds in a way that is accessible to people already familiar with languages such as C#. To all the folks talking about how Microsoft is just copying good features that already exist in other languages, I'd just like to know how exactly that is a bad thing? Is it perhaps because it blurs the advantages of your own personal languages? Kinda thought so. With regard to JSF. JavaServer Faces does not deserve comparison with ASP.Net. It was the Java answer to this technology, and as someone who has made a considerable investment in JSF in the past, I can tell you that it is garbage. Please, if you must talk of a good Java web application framework, pile some praise on something more worthy, such as Wicket. And to McNaz, perhaps you'd do us the courtesy of stating just what technology you are currently using. If it is so superior, I'd like to take it for a spin. If all you are is bluster, please refrain from dropping trolls into intelligent conversations.

Steve Thompson

New Comments to this post are disabled
Powered by Community Server, by Telligent Systems