<?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>C# &amp;quot;dynamic,&amp;quot; Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx</link><description>Yesterday, I made an attempt to introduce the C# dynamic feature by describing what change there has been to the language, what scenarios we hope to affect by that change, and some overview of what dynamic operations look like in C# 4 as it stands in</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9020612</link><pubDate>Tue, 28 Oct 2008 20:41:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9020612</guid><dc:creator>Keith J. Farmer</dc:creator><description>&lt;p&gt;Hey, Chris -- do you think you could explain the parameter argument to GetMetaObject, and how/why it's supposed to be used?&lt;/p&gt;</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9021021</link><pubDate>Wed, 29 Oct 2008 00:45:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9021021</guid><dc:creator>cburrows</dc:creator><description>&lt;p&gt;Hi Keith,&lt;/p&gt;
&lt;p&gt;The DLR uses expression trees internally to communicate rules and actions that are the result of binding particular operations. The parameter parameter is a ParameterExpression that represents the target object. &lt;/p&gt;
&lt;p&gt;I would prefer to spend my time talking about C#, so I'm not going to pursue the details of the DLR implementation much deeper than that. Unfortunately I also don't have any PDC-era pointers for you, although Martin Maly's blog is a great resource (&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/mmaly/"&gt;http://blogs.msdn.com/mmaly/&lt;/a&gt;). You should install the CTP and debug around. The code I've posted compiles and works with it.&lt;/p&gt;
&lt;p&gt;chris&lt;/p&gt;
</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9021836</link><pubDate>Wed, 29 Oct 2008 11:25:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9021836</guid><dc:creator>kfarmer</dc:creator><description>&lt;p&gt;Unfortunately, Martin's blog is absent this info. &amp;nbsp;I'll see if I can prod him or his cohorts about it if I remember. &amp;nbsp;It's been a while since I was active in DLR-land (ie, shortly after I joined MSFT).&lt;/p&gt;
&lt;p&gt;Back to C# itself, part of why I ask, actually, is in response to the known limitation dynamic method binding in C# not being able to bind extension methods. &amp;nbsp;I'm pondering what sort of workarounds would be possible, if any.&lt;/p&gt;
&lt;p&gt;For that matter, I wonder why it's even a limitation? &amp;nbsp;The compiler *could* embed information about what extension methods would have been in-scope at that location during the original compile, and pass that to the late-binding algorithm. &amp;nbsp;Or is this the DLR's limitation? &amp;nbsp;(I remember looking into it a while ago, and almost had it hacked into submission)&lt;/p&gt;
&lt;p&gt;Or is it just below the feature bar, like yield foreach? :)&lt;/p&gt;
</description></item><item><title>C# "dynamic," Part III</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9022090</link><pubDate>Wed, 29 Oct 2008 15:00:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9022090</guid><dc:creator>Chris Burrows' Blog</dc:creator><description>&lt;p&gt;Here are a few good resources that you ought to look at for information about dynamic from PDC: Anders&lt;/p&gt;
</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9022872</link><pubDate>Wed, 29 Oct 2008 22:33:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9022872</guid><dc:creator>RednaxelaFX</dc:creator><description>&lt;p&gt;@Keith&lt;/p&gt;
&lt;p&gt;My guess that the reason of not being able to bind extension methods is because this piece of info of whether an extension method is in scope of not is not available to the binders at runtime. The default binder for CLR objects can only find out what members a type has, and extension methods are not a part of the type to be extended; there isn't quite a way to pass this piece of info into the DLR in the way it is designed now.&lt;/p&gt;
&lt;p&gt;Well, someone might be able to get a smarter binder to do this, of course. If a binder's constructor can take a list of possibly applicable extension methods' MethodInfo (which the C# compiler would know at compile time), then it's possible for the binder to get extension methods working.&lt;/p&gt;</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9023527</link><pubDate>Thu, 30 Oct 2008 06:02:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9023527</guid><dc:creator>Keith J. Farmer</dc:creator><description>&lt;p&gt;@RednaxelaFX&lt;/p&gt;
&lt;p&gt;Your second paragraph was the point I was trying to make. &amp;nbsp;Having spelunked through earlier releases about a year ago, I know roughly where the DLR would need that information. &amp;nbsp;It's just a matter of putting it there and, of course, testing it to within an inch of someone else's life.&lt;/p&gt;
&lt;p&gt;That, unfortunately, I think would be the biggest blocker in having this capability in C#4.&lt;/p&gt;</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9023836</link><pubDate>Thu, 30 Oct 2008 09:56:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9023836</guid><dc:creator>RednaxelaFX</dc:creator><description>&lt;p&gt;@Keith&lt;/p&gt;
&lt;p&gt;Well, I'd like to put it this way:&lt;/p&gt;
&lt;p&gt;Think about it, in IronPython, Python types that map onto plain CLR types can have extensions over them; and the same is with IronRuby's Ruby types and all other languages based on the DLR, except...C# and VB I guess. The reason for this is that C# and DLR make extension types in a different way. C# extension methods are just syntactic sugar resolved at compile time and doesn't really carry into runtime, where as IronPython extension methods for Python types register themselves to the binder with attributes. Thus C# extension methods are only available in a certain scope at compile time (which is somehow a good thing, less confusion), while Python extensions affect the whole Python part of the program.&lt;/p&gt;
&lt;p&gt;If one wants the same semantics as what IronPython extensions give, he/she can simply implement extension methods simillar to the way IronPython does today -- with the restriction that the target type to be extended has to implement IDynamicObject for custom dynamic lookups, which, probably turns into inheriting from System.Dynamic.DynamicObject, which might not be feasible.&lt;/p&gt;
&lt;p&gt;The other way around, the C# compiler will have to generate a list of possibly applicable extension methods in scope, and pass that list into the call payload at the call site, so that C# binder has a chance of picking it up later at runtime. Haven't thought about the implications of this; it might imply further complicated scoping rules, and that'd be a problem.&lt;/p&gt;
&lt;p&gt;@Chris&lt;/p&gt;
&lt;p&gt;I'd like to ask a question: where's that System.Dynamic.DynamicObject class in Anders' and Jim's talk? Didn't find it in System.Core.dll in the CTP. Tried the IDO impl sample from C# Future and it worked, though.&lt;/p&gt;
&lt;p&gt;- RednaxelaFX (Kris Mok)&lt;/p&gt;</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9024957</link><pubDate>Thu, 30 Oct 2008 21:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9024957</guid><dc:creator>cburrows</dc:creator><description>&lt;p&gt;Re: the lack of support for extension methods. You're both on the right track. Extension methods are a compile-time feature that would have required us to push some context into the C# Runtime Binder. It wouldn't have been impossible, but consider that extension methods are often used in LINQ scenarios and that there, we have a bigger problem of converting lambdas to &amp;quot;dynamic.&amp;quot; So we decided to punt on this for C# 4. All decisions like this are difficult and complicated.&lt;/p&gt;
</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9024959</link><pubDate>Thu, 30 Oct 2008 21:10:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9024959</guid><dc:creator>cburrows</dc:creator><description>&lt;p&gt;RednaxelaFX, DynamicObject is not in the CTP. I mentioned that in Part III. Sorry!&lt;/p&gt;
</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9034757</link><pubDate>Mon, 03 Nov 2008 22:49:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9034757</guid><dc:creator>Tobi</dc:creator><description>&lt;p&gt;Hey RednaxelaFX - if you want to look at a more detailed example on how to implement IDynamicObject take a look at my post &lt;a rel="nofollow" target="_new" href="http://saftsack.fs.uni-bayreuth.de/~dun3/archives/first-look-ducktyping-c-4-0-idynamicobject-metaobject/202.html"&gt;http://saftsack.fs.uni-bayreuth.de/~dun3/archives/first-look-ducktyping-c-4-0-idynamicobject-metaobject/202.html&lt;/a&gt; - I don't go into details, but it might help you figure the parameters out.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Tobi&lt;/p&gt;</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9035033</link><pubDate>Mon, 03 Nov 2008 23:52:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9035033</guid><dc:creator>RednaxelaFX</dc:creator><description>&lt;p&gt;@Tobi&lt;/p&gt;
&lt;p&gt;Thanks for the link. :-)&lt;/p&gt;
&lt;p&gt;I didn't have any problems with understanding IDynamicObject and implementing my own, though...in fact I implement it a few times already. I implemented my first one back in May for my bachelor DP. Later on, the whole IDynamicObject interface changed and got deprecated as the IOldDynamicObject, and a newer version of IDynamicObject appeared, with a clearer MetaObject Protocol.&lt;/p&gt;
&lt;p&gt;I'm writing a converter in a different perspective from yours, and I'll see if I can clean the code up a little so that I can write a post about it. Thanks again for the link, didn't think of using the Castle library before.&lt;/p&gt;
&lt;p&gt;- RednaxelaFX&lt;/p&gt;</description></item><item><title>Community Convergence XLVII</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9035151</link><pubDate>Tue, 04 Nov 2008 00:11:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9035151</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>&lt;p&gt;Welcome to the 47th Community Convergence. We had a very successful trip to PDC this year. In this post&lt;/p&gt;
</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9038574</link><pubDate>Tue, 04 Nov 2008 13:19:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9038574</guid><dc:creator>Tobi</dc:creator><description>&lt;p&gt;@RednaxelaFX&lt;/p&gt;
&lt;p&gt;Sorry, totally phased out and copied the wrong name. :-D I guess I was thinking about Keith J. Farmer. Sorry. :-D&lt;/p&gt;
&lt;p&gt;Anyway, I am looking forward to your post about the converter. I would be glad, if you could drop me a link!&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Tobi&lt;/p&gt;</description></item><item><title>C# "dynamic," Part IV</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9050002</link><pubDate>Thu, 06 Nov 2008 20:45:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9050002</guid><dc:creator>Chris Burrows' Blog</dc:creator><description>&lt;p&gt;Today, let's geek out about the language design regarding the dynamic type. Type in the language vs.&lt;/p&gt;
</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9058949</link><pubDate>Tue, 11 Nov 2008 02:59:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9058949</guid><dc:creator>KeithH</dc:creator><description>&lt;p&gt;I'm messing around with the VS 2010 CTP but I can't find the System.Dynamic namespace. &amp;nbsp;What assembly is this in?&lt;/p&gt;</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9058981</link><pubDate>Tue, 11 Nov 2008 03:28:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9058981</guid><dc:creator>RednaxelaFX</dc:creator><description>&lt;p&gt;@KeithH,&lt;/p&gt;
&lt;p&gt;It's not there in the CTP. But you may want to check out the lastest version of DLR, which has this System.Dynamic namespace. You can find it in the source drops on IronPython's CodePlex site.&lt;/p&gt;</description></item><item><title>C# "dynamic," Part V</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9059087</link><pubDate>Tue, 11 Nov 2008 05:04:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9059087</guid><dc:creator>Chris Burrows' Blog</dc:creator><description>&lt;p&gt;Let's look at this: dynamic d = null ; object o = d; // not an implicit conversion Last time , I said&lt;/p&gt;
</description></item><item><title>re: C# "dynamic," Part II</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9062955</link><pubDate>Wed, 12 Nov 2008 18:27:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9062955</guid><dc:creator>ignu</dc:creator><description>&lt;p&gt;I'm having a difficult time grocking MetaObject Call, and getting it to actually return an object.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://stackoverflow.com/questions/283143/can-i-implement-methodmissing-in-c-4-and-have-it-actually-return-a-value"&gt;http://stackoverflow.com/questions/283143/can-i-implement-methodmissing-in-c-4-and-have-it-actually-return-a-value&lt;/a&gt;&lt;/p&gt;</description></item><item><title>C# "dynamic," Part VI</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9071320</link><pubDate>Fri, 14 Nov 2008 17:20:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9071320</guid><dc:creator>Chris Burrows' Blog</dc:creator><description>&lt;p&gt;We left off last time with this piece of code public class C { public static void M( int i) { } public&lt;/p&gt;
</description></item><item><title>C# Dynamic - CSharp's new feature of the coming version 4.0</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9221699</link><pubDate>Mon, 15 Dec 2008 21:01:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9221699</guid><dc:creator>Journal of Abu Sayed Mohammad Ismail</dc:creator><description>&lt;p&gt;Very good resources for the coming version... Sam Ng Dynamic in C# Part One Dynamic in C# Part Two Chris&lt;/p&gt;</description></item><item><title>C# “dynamic,” Part VII</title><link>http://blogs.msdn.com/cburrows/archive/2008/10/28/c-dynamic-part-ii.aspx#9394081</link><pubDate>Wed, 04 Feb 2009 03:35:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9394081</guid><dc:creator>Chris Burrows' Blog</dc:creator><description>&lt;p&gt;It has been a while since I posted anything here, and I have the same excuse everyone else does. Work,&lt;/p&gt;
</description></item></channel></rss>