<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jim Hugunin's Thinking Dynamic : DLR</title><link>http://blogs.msdn.com/hugunin/archive/tags/DLR/default.aspx</link><description>Tags: DLR</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>The One True Object (Part 1)</title><link>http://blogs.msdn.com/hugunin/archive/2007/05/02/the-one-true-object-part-1.aspx</link><pubDate>Wed, 02 May 2007 22:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2379145</guid><dc:creator>hugunin</dc:creator><slash:comments>12</slash:comments><comments>http://blogs.msdn.com/hugunin/comments/2379145.aspx</comments><wfw:commentRss>http://blogs.msdn.com/hugunin/commentrss.aspx?PostID=2379145</wfw:commentRss><description>&lt;P&gt;I'm very excited by the level of interest that I'm seeing from folks who want to better understand what the DLR is all about.&amp;nbsp;I'm also sorry that we don't have a fully documented detailed story for you today. If you want a detailed whitepaper and documented APIs, you're going to have to wait a while.&amp;nbsp; If you're happy with source code and blog entries, then you can start messing about today.&amp;nbsp;And if you just want to play with working code, download the silverlight bits and start exploring what you can do on top of the DLR with Python and JavaScript together today.&lt;/P&gt;
&lt;P&gt;I'm starting my design notes blogging today with my first entry on the dynamic type system that is one of the three key components in the DLR - and the one that I think is most important.&amp;nbsp; The corner-stone of the DLR is support for a shared dynamic type system. This lets these dynamic languages easily and naturally talk to each other and share code. Equally important is that we want these dynamic languages to be able to work with the existing powerful static languages on the platform such as VB.NET and C#. We want to ensure that the huge wealth of both existing and to-be-written libraries designed for .NET all just work from dynamic languages. There's a standard pattern for achieving this kind of interoperability through wrappers and marshaling layers. Here's the pattern as I implemented it for Jython - Python running on the JVM.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/hugunin/WindowsLiveWriter/TheOneTrueObject_9F7E/image%7B0%7D%5B6%5D.png" mce_href="http://blogs.msdn.com/blogfiles/hugunin/WindowsLiveWriter/TheOneTrueObject_9F7E/image%7B0%7D%5B6%5D.png" atomicselection="true"&gt;&lt;IMG height=226 src="http://blogs.msdn.com/blogfiles/hugunin/WindowsLiveWriter/TheOneTrueObject_9F7E/image%7B0%7D_thumb%5B4%5D.png" width=405 mce_src="http://blogs.msdn.com/blogfiles/hugunin/WindowsLiveWriter/TheOneTrueObject_9F7E/image%7B0%7D_thumb%5B4%5D.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Notice that with this pattern that the Python types exist in their own little world (they are in orange) and for every underlying type I need to put the objects into a Python-specific wrapper. This standard pattern is okay if you're only interested in supporting a single language.&amp;nbsp;In my example above, so long as I'm only writing Python code then all of my objects will be PyObjects and they'll all work great together with all the Python-specific information on them.&amp;nbsp;Where this pattern really breaks down is when you want to support integration with multiple languages.&amp;nbsp; In this case every time an object moves from one language to another it needs to be unwrapped from the source language and then rewrapped appropriately for the destination.&amp;nbsp; This can obviously have performance issues as these wrapper objects are created and discarded for any cross-language calls.&lt;/P&gt;
&lt;P&gt;The wrapper approach can also have deeper problems. One challenge is just to figure out what object to pass.&amp;nbsp;For example, if Python has a PyString and it calls a C# function that expects an Object, should it pass the PyString or should it unwrap it into a String? These kinds of subtle type issues never have a good answer.&amp;nbsp;Even worse are the nasty problems that can be caused by loss of object identity when objects are silently wrapped and unwrapped behind the programmers back.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;This wrapper pattern is also the same one used by most of the popular dynamic languages implemented in C as well.&amp;nbsp;When implementing a dynamic language in C, these kinds of wrappers make a lot of sense because a C pointer doesn't have any useful runtime type information so you need to decorate it with a layer that can provide the runtime type information that's needed. However, managed runtimes like the CLR provide rich type information for their standard objects, so it should be possible to use those objects directly without the confusion and cost of wrappers and marshalling. We exploit this in the DLR, and this is the type system that we actually use.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/hugunin/WindowsLiveWriter/TheOneTrueObject_9F7E/image%7B0%7D%5B11%5D.png" mce_href="http://blogs.msdn.com/blogfiles/hugunin/WindowsLiveWriter/TheOneTrueObject_9F7E/image%7B0%7D%5B11%5D.png" atomicselection="true"&gt;&lt;IMG height=151 src="http://blogs.msdn.com/blogfiles/hugunin/WindowsLiveWriter/TheOneTrueObject_9F7E/image%7B0%7D_thumb%5B7%5D.png" width=282 mce_src="http://blogs.msdn.com/blogfiles/hugunin/WindowsLiveWriter/TheOneTrueObject_9F7E/image%7B0%7D_thumb%5B7%5D.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;This means that all of the objects in the DLR are exactly the same as the objects in the CLR.&amp;nbsp;We're adding capabilities to better support common dynamic operations, but we're still deeply rooted in the powerful existing libraries and languages on .NET. We need to have a single unified type system without marshaling and wrapper layers between our languages if we're going to have truly seamless integration between them.&lt;/P&gt;
&lt;P&gt;Now that I've reached the end of this first entry, I fear that it might be a little unsatisfying. All that I've explained so far about the dynamic type system is that it uses exactly the same objects and metadata that are already used by the statically typed objects already running in the CLR.&amp;nbsp; Well, I'm not going to let that stop me from pushing this to the web today.&amp;nbsp; More details about how we get a dynamic type system into the CLR without wrapper layers will have come next.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2379145" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/hugunin/archive/tags/MIX07/default.aspx">MIX07</category><category domain="http://blogs.msdn.com/hugunin/archive/tags/DLR/default.aspx">DLR</category></item><item><title>First DLR talk video from MIX</title><link>http://blogs.msdn.com/hugunin/archive/2007/05/02/first-dlr-talk-now-on-the-web.aspx</link><pubDate>Wed, 02 May 2007 21:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2378000</guid><dc:creator>hugunin</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/hugunin/comments/2378000.aspx</comments><wfw:commentRss>http://blogs.msdn.com/hugunin/commentrss.aspx?PostID=2378000</wfw:commentRss><description>&lt;P&gt;First, my apologies for not posting my&amp;nbsp;first entry&amp;nbsp;on the type system yesterday.&amp;nbsp;I was completely wiped out after preparing and delivering this talk and then talking to all the interested people here at MIX.&amp;nbsp;For those of you who aren't at MIX, you can see a &lt;A href="http://sessions.visitmix.com/default.asp?event=1011&amp;amp;session=2012&amp;amp;pid=DEV02&amp;amp;disc=&amp;amp;id=1511&amp;amp;year=2007&amp;amp;search=DEV02" mce_href="http://sessions.visitmix.com/default.asp?event=1011&amp;amp;session=2012&amp;amp;pid=DEV02&amp;amp;disc=&amp;amp;id=1511&amp;amp;year=2007&amp;amp;search=DEV02"&gt;video of John's and my talk&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Also, for those of you who want a more frequently updated blog from an expert on the DLR, be sure to read &lt;A class="" href="http://www.iunknown.com/" mce_href="http://www.iunknown.com"&gt;John's blog&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2378000" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/hugunin/archive/tags/MIX07/default.aspx">MIX07</category><category domain="http://blogs.msdn.com/hugunin/archive/tags/DLR/default.aspx">DLR</category></item><item><title>A Dynamic Language Runtime (DLR)</title><link>http://blogs.msdn.com/hugunin/archive/2007/04/30/a-dynamic-language-runtime-dlr.aspx</link><pubDate>Mon, 30 Apr 2007 19:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2341235</guid><dc:creator>hugunin</dc:creator><slash:comments>132</slash:comments><comments>http://blogs.msdn.com/hugunin/comments/2341235.aspx</comments><wfw:commentRss>http://blogs.msdn.com/hugunin/commentrss.aspx?PostID=2341235</wfw:commentRss><description>&lt;P&gt;Today, at &lt;A href="http://visitmix.com/" mce_href="http://visitmix.com/"&gt;MIX 07&lt;/A&gt;, we announced a new level of support for dynamic languages on .NET that we're calling the DLR.&lt;/P&gt;
&lt;P&gt;From the beginning, Microsoft's .NET framework was designed to support a broad range of different programming languages on a Common Language Runtime (CLR).&amp;nbsp; The CLR provides shared services to these languages ranging from a world-class GC and JIT to a sandboxed security model to tools integration for debugging and profiling.&amp;nbsp; Sharing these features has two huge benefits for languages on the CLR.&amp;nbsp; First, it's easier to implement a language because lots of difficult engineering work is already done for you.&amp;nbsp; Second, and more importantly, these languages can seamlessly work together and share libraries and frameworks so that each language can build on the work of the others.&lt;/P&gt;
&lt;P&gt;The CLR has good support for dynamic languages today.&amp;nbsp; IronPython-1.0 demonstrates this.&amp;nbsp; The new Dynamic Language Runtime (DLR) adds a small set of key features to the CLR to make it dramatically better.&amp;nbsp; It adds to the platform a set of services designed explicitly for the needs of dynamic languages.&amp;nbsp; These include a shared dynamic type system, standard hosting model and support to make it easy to generate fast dynamic code.&amp;nbsp; With these additional features it becomes dramatically easier to build high-quality dynamic language implementations on .NET.&amp;nbsp; More importantly, these features enable all of the dynamic languages which use the DLR to freely share code with other dynamic languages as well as with the existing powerful static languages on the platform such as VB.NET and C#.&lt;/P&gt;
&lt;P&gt;The DLR is about giving you the best experience for your language - true to the language, excellent tools, performance and seamless integration with a wealth of libraries and platforms. The essential benefits of the DLR are about sharing. It lets language implementers share standard features rather than rebuilding them from scratch. This lets them focus on the features that make a given language unique rather than on reinventing yet another GC system. It lets developers share code regardless of the language the code is implemented in and to use whatever language they prefer regardless of the language preferred by the environment they want to run in. Coupled with the &lt;A href="http://www.silverlight.net/" mce_href="http://www.silverlight.net/"&gt;Silverlight 1.1&lt;/A&gt; platform announced today, it even lets languages share a sandboxed security model and browser integration.&amp;nbsp; This means that developers building browser-based applications can now use their preferred language even for client-side code.&lt;/P&gt;
&lt;P&gt;We're initially building four languages on top of the DLR - Python, JavaScript (EcmaScript 3.0), Visual Basic and Ruby. We shipped today both Python and JavaScript as part of the &lt;A href="http://www.silverlight.net/" mce_href="http://www.silverlight.net/"&gt;Silverlight 1.1alpha1&lt;/A&gt; release today. John Lam and I will be demoing all four languages, including VB and Ruby, working together during our talk tomorrow at 11:45.&lt;/P&gt;
&lt;P&gt;In addition to the Silverlight release, we've also made the full source code for both IronPython and all of the new DLR platform code available on codeplex under the BSD-style &lt;A href="http://www.microsoft.com/resources/sharedsource/licensingbasics/permissivelicense.mspx" mce_href="http://www.microsoft.com/resources/sharedsource/licensingbasics/permissivelicense.mspx"&gt;Microsoft Permissive License&lt;/A&gt;.&amp;nbsp;All of that code can be downloaded today as part of the IronPython project at &lt;A href="http://codeplex.com/ironpython" mce_href="http://codeplex.com/ironpython"&gt;codeplex.com/ironpython&lt;/A&gt;. If you want to know more about the DLR, you should feel free to download the code.&amp;nbsp; However, you should understand that this is a very early release of these bits and we still have significant work left to do including refactoring, design changes, performance tuning - not to mention documentation. &lt;/P&gt;
&lt;P&gt;For the short term, our focus is on using a small number of languages to drive the first wave of DLR development where we can work closely and face-to-face with the developers in order to iron out the worst kinks in the DLR design. After this initial phase, we want to reach out to the broader language community.&amp;nbsp; If you're building a language on top of .NET and are interested in supporting dynamic language features then we want your feedback on the DLR. However, I'd discourage you from trying to implement on top of the DLR today. I don't want you to get frustrated trying to work with these really early bits and then not be interested in working with us when we're better prepared to engage with the language community. We plan to kick off a broader engagement with language implementers at the upcoming lang.net conference in three months - at the end of July.&amp;nbsp; This will be the best place to really engage with the DLR and let us know what we got wrong.&lt;/P&gt;
&lt;P&gt;In the meantime, I'll be using this blog to post our design notes for the DLR as they're written and any feedback you have on the design is welcomed. Tomorrow I'll talk more about the shared dynamic type system and the "One True Object".&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2341235" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/hugunin/archive/tags/MIX07/default.aspx">MIX07</category><category domain="http://blogs.msdn.com/hugunin/archive/tags/DLR/default.aspx">DLR</category></item></channel></rss>