If there is anything that I’ve learned, it’s that there are some seriously smart, passionate, and motivated people at Microsoft. So, when I first started running into horrible code on the net using dynamic typing, I was confused. Why is Microsoft writing, and even promoting the idea of dynamic typing? I mean, we all know that in static programming languages, you should use static, strong-typing, so the compiler can enforce that for you, and so you get good intellisense. Yet, I kept seeing more and more Ruby fans coming to .NET, spreading the “loose-typing” dogma.
Earlier today Scott Gu was speaking on the LIDNUG webcast, and even he seems to be a fan of dynamic typing and the dynamic languages. So, that prompted me to see if I could find more (and better) information on the subject. Sure enough, I eventually ran across this video from PDC08, by the legendary Anders Hejlsberg:
The Future of C#
Keep in mind this was during 2008, and he was just then talking about what was coming in .NET 4.0, which is now out. This session covers dynamic languages, optional and named parameters, and parallelism. The first :40 minutes or so go into a good amount of detail about why there is dynamic typing, and also goes into some good detail.
To be clear, he doesn’t talk about the wisdom of dynamic languages who use dynamic types for everything – but instead he’s talking about C#’s ability to support dynamic types (types that aren’t checked at compile-time, and instead just “trust” things will be right at run-time.
In short, here’s what I took away from this:
- Dynamic typing was added to C#, because .NET languages are ultimately becoming a melting pot of static typing, dynamic typing, and functional programming. So this is just a new feature to make C# more useful for the times when you need this sort of functionality. The ultimate goal would be that you could write your application using static techniques, but you could easily add dynamic or functional programming elements seamlessly, because the language would support that.
Anyhow, this shed a whole new light on this topic. The video is around 70: minutes or so, but is pretty good!!