got net?

Kevin Hazzard's Brain Spigot

About the author

Welcome to Kevin Hazzard's blog.
E-mail me Send mail

Recent posts

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

The DLR is the Language of Languages

The more I study the Dynamic Language Runtime (DLR), the more I am convinced that it deserves to be the centerpiece of Microsoft's .NET 4.0 strategy. I am a statically typed languages guy. Or at least I have been. I love the robustness that the compiler applies to certain preconditions for using objects. Type safety is great but I don't think that statically typed languages go far enough to be honest. I am excited about Spec# because of its supports for invariants, pre and post conditions, static program verification, etc. Will Spec# ever go mainstream? It doesn't appear to have the momentum that F# or IronPython have, to be frank about it. But maybe we'll see some ideas creep into C# from the Spec# research that Microsoft is doing. I have my fingers crossed.

On the other end of the spectrum is IronPython 2.0, Microsoft's first DLR-based implementation of the Python programming language. I just love Python. It's so clean and simple that almost anyone can learn and use it effectively after studying it for an hour or two. If I could send a note to myself in the past to change one thing about my career (besides the winning lottery numbers for the past decade) it would be to encourage my younger self to learn Python back in the mid-1990s. I knew about the language back then but I was a C++ bigot. I wish I had been more open minded. So much of my approach to software development would have been better if I had learned Python back then. I was working in the Intel Architecture Labs and had the perfect opportunity to do so, too. We were helping a very young company named Yahoo.com to evaluate e-mail providers to purchase. We ended up recommending RocketMail technology which was based almost entirely on server-side Python scripting. I had the perfect opportunity to learn Python from real experts right there in front of me and I let it slip right by me.

Well, no sense living in the past, right? I know Python really well now and it has changed the way I think about software development. Learning Python made me fall in love with Ruby and LISP and F#, too. I'm a real polyglot now and being able to understand how these other languages solve problems helps me design better in the language I use every day: C#. By the way, the term polyglot from its Greek roots literally means many tongues. I'm excited about the DLR because it's enabling Python and Ruby on my favorite platform. But the DLR is so much more important than that. It's the Language of Languages. The DLR defines the primitives that must exist on the boundaries of our languages to make them interoperate. In the same way that COM unified the dispatch model in the 1990s through IUnknown and IDispatch, the DLR will define the call semantics and dispatch models for the .NET Framework for the 2010s through IDynamicObject and DynamicMetaObject.

Pretty soon, we'll see a flurry of languages appear on top of the DLR. A bunch of them are already in development. But we'll also see a wave of DLR object binders appear that have no significant language support on the platform, too. The effects will be profound. Imagine a Java RMI bridge written as a DLR object binder. Using the dynamic type in C# 4.0, you could make calls to remote Java objects from .NET as if they were just part of the framework. Or imagine a type binder that exposes RESTful services as a dynamic object model. There's really no end to the possibilities here. The key to all of these scenarios is the enablement of dynamic services and that sounds a lot like what Web 2.0 was supposed to be.


Tags:
Categories: Architecture | C# | DLR | F# | Python | Ruby | Software Dev
Posted by kevin on Wednesday, January 07, 2009 9:28 AM
Permalink | Comments (12) | Post RSSRSS comment feed

Comments

Jonathan Pryor

Wednesday, January 07, 2009 10:55 AM

Jonathan Pryor

Given how few features are being added to C#4, and that dynamic is one of those few features, I suspect that the DLR is one of the centerpieces of .NET 4.0.  (If it wasn't a centerpiece, why add support to C# for it? Wink

The one downside is that it's going to kill autocomplete.  Sure, you can use a variety of object binders to invoke remove Java objects or RESTful services, but in order to do so you'll have no IDE support.  So a usually compile-time error (such as mis-spelling or mis-casing a method name) will pass most compile-time checking and instead become a runtime error.

Bad?  Not necessarily, as it'll allow far more convenient use of these services, but it will be something to keep in mind.  It'll also put increased emphasis on test tools such as NUnit, as tests will be needed to check what the compiler previously checked, and increased testing can only be a good thing (hopefully it'll spill over into the static code!).

Jeff LeBert United States

Wednesday, January 07, 2009 2:18 PM

Jeff LeBert

A bunch of Spec# has made it into .Net 4.0 (not just C#). It's called Code Contracts and I'm very excited about it. I'm also pretty excited about the DLR but I think I will use Code Contracts more.

alvinashcraft.com

Thursday, January 08, 2009 10:50 AM

pingback

Pingback from alvinashcraft.com

Dew Drop - January 8, 2009 | Alvin Ashcraft's Morning Dew

Todd King United States

Thursday, January 08, 2009 12:11 PM

Todd King

The DLR is a great addition (along with Silverlight) and will make .NET THE virtual machine/platform (Ruby on .Net?  Shweeet!)

I've been full circle with OO languages over the past 15 years.  Having started with Smalltalk and moved (not to imply progressed) through C++, Python, Eiffel, Java, Ruby and C#, I realized that most all "goodness" descends from Smalltalk and Eiffel, which are complete opposites from a static vs. dynamic types standpoint, but share most all important OO principles, and differ on a few.

I'm continually amazed at how principles and idioms that have been around and available for decades are suddenly "discovered" when they appear with a newcomer to the software dev scene.  While I'm glad to that people do eventually "get wise", I still shake my head regularly and feel old.

Spec# is an incomplete realization of Eiffel's Design by Contract implementation, and while I applaud the effort toward a robust formal and executable specification mechanism, I've come to realize over the years that unit testing over the same criteria (pre/post conditions and class invariants) works as well, if not better.  And with that, dynamic languages prove to be much less cumbersome which which to develop software.

Kevin Hazzard United States

Thursday, January 08, 2009 2:08 PM

Kevin Hazzard

Jonathan: If you assume that using C#, for example, that you'll still be living in a write-compile-debug world, it's true that Intellisense is tough. But what if the C# IDE had a more REPL-like feel? Then autocomplete features like Intellisense become quite possible. Look a the DLR Console at silverlight.net/samples/sl2/dlrconsole/index.html for an example of autocomplete using Python (in a web browser no less). The C# Compiler As A Service ideas swirling around for C# 5.0 are interesting in this respect. We'll see how that turns out. And I agree about the comment concerning more unit testing. In my experience, languages with stronger design by contract capabilities allow people to avoid unit testing by giving the false impression that they have their bases covered. Dynamic languages encourage unit testing specifically because they are loose.

Kevin

Kevin Hazzard United States

Thursday, January 08, 2009 2:20 PM

Kevin Hazzard

Jeff: do you blog? I'd love to read about your experience with Code Contracts in C# 4.0.

Kevin

Kevin Hazzard United States

Thursday, January 08, 2009 2:29 PM

Kevin Hazzard

Todd: are you calling me a newbie? That's like being asked to show my ID when I buy beer. I mean, c'mon! Just kidding. I know exactly what you mean. The modern software development landscape is broad and deep enough that old ideas get lost and rediscovered all the time. Wouldn't it be great to have a DLR implementation of Smalltalk? Or how about Smalltalk in the browser through Silverlight? I can dream.

Kevin

Todd King United States

Thursday, January 08, 2009 5:34 PM

Todd King

Now you know I would never call you a newbie... that would be quite funny ("I don't care who ya are, that's funny right there now").

We will kind of have Smalltalk in Silverlight with IronRuby  Wink  The main reason I like Ruby is it's Smalltalk-like aspects.

Smalltalk has always been strongest as a Client-Server platform,  so maybe Smalltalk on the DLR is not a bad idea.
But people seem to just find the syntax too quirky to read (even though parse rules are about as simple as it gets).

Then of course there is Seaside (http://www.seaside.st/) which breaks all the rules of the Web, and turns it into a client-server app...

Jeff LeBert United States

Thursday, January 08, 2009 6:08 PM

Jeff LeBert

I've been tempted to blog, but haven't got the energy up enough to do a good job. It wouldn't hurt though considering the economy. Smile

I haven't done too much with Code Contracts yet. I'm really trying to find some way to bring in new fangled ideas like unit testing, variable names longer than 3 characters, etc. at work. Up to now, I've been trying to catch issues with custom FxCop rules and more recently StyleCop. I have a set of general rules at http://www.codeplex.com/JSLFxCop. I have a bunch more custom FxCop rules that are specific to our "framework" at work. I am working on building a set of StyleCop rules currently.

My hope is that I can get rid of some of this with CodeContract.

DouglasH United States

Tuesday, January 13, 2009 10:00 PM

DouglasH

code contracts are not fully implemented in the current ctp.  so about the only thing to show on them is the pdc talk.  
http://channel9.msdn.com/pdc2008/TL51/

nobrainerprofits.com

Saturday, January 17, 2009 9:53 AM

pingback

Pingback from nobrainerprofits.com

The DLR is the Language of Languages | No Brainer Profits

techtrendwatching.com

Tuesday, January 27, 2009 8:58 PM

pingback

Pingback from techtrendwatching.com

The DLR is the Language of Languages | Tech Trend Watching

Comments are closed