240 likes | 360 Views
Dynamic Languages & The .Net Framework. Shay Friedman ActionBase http://blogs.microsoft.co.il/blogs/shayf. בָבָא כֶל שַיו אָרְבֵה. http://www.flickr.com/photos/ko_an/1472480778/. hru ? gr8, i noe u <3 me, i luv u 2. SMS. http://www.flickr.com/photos/qilin/527130002/.
E N D
Dynamic Languages & The .Net Framework Shay Friedman ActionBase http://blogs.microsoft.co.il/blogs/shayf
בָבָא כֶל שַיו אָרְבֵה http://www.flickr.com/photos/ko_an/1472480778/
hru? gr8, inoe u <3 me, iluv u 2 SMS http://www.flickr.com/photos/qilin/527130002/
תמסור לקמב"ץ שיש אבט"ש בלת"מ חבל"ז בבח"א! ושישכח מרבעו"ש! http://www.flickr.com/photos/kikasso/1399327118/
Dynamic Languages & The .Net Framework Shay Friedman ActionBase http://blogs.microsoft.co.il/blogs/shayf
Agenda • The Dynamic Languages World • The Dynamic Language Runtime • Dynamic Languages on Everyday Tasks • The Future: Dynamic Capabilities in .Net 4.0 • Q & A • Summary
demo Dynamic Languages Introduction
Dynamic Language Runtime IronRuby IronPhyton C# VB.Net Others… Dynamic Language Runtime Expression Trees Dynamic Dispatch Call Site Caching Object Binder JavaScript Binder Python Binder Ruby Binder COM Binder
Dynamic Language Runtime – LOLCODE Code start HAI CAN HAS STDIO? I HAS A FISH ITZ "Yummy" VISIBLE FISH VISIBLE "HAI WORLD!" IM IN YR LOOP VISIBLE “LOOP!” KTHX KTHXBYE Equivalent to: FISH = “Yummy”; Equivalent to: Console.WriteLine(“HAI WORLD!”); Loop start Loop end Code end
demo Dynamic Languages with .Net
demo Dynamic Languages on Everyday Tasks
Dynamic Capabilities in C# 4.0 נוּדְנִיק
Dynamic Capabilities in C# 4.0 Calculator calc = GetCalculator(); int sum = calc.Add(10, 20); object calc = GetCalculator(); TypecalcType = calc.GetType(); object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, newobject[] { 10, 20 }); int sum = Convert.ToInt32(res); ScriptObject calc = GetCalculator(); object res = calc.Invoke("Add", 10, 20); int sum = Convert.ToInt32(res); Statically typed to be dynamic dynamic calc = GetCalculator(); int sum = calc.Add(10, 20); Dynamic conversion Dynamic method invocation
Dynamic Capabilities in C# 4.0 publicabstractclassDynamicObject : IDynamicObject { publicvirtualobjectGetMember(GetMemberBinder info); publicvirtualobjectSetMember(SetMemberBinder info, object value); publicvirtualobjectDeleteMember(DeleteMemberBinder info); publicvirtualobjectUnaryOperation(UnaryOperationBinder info); publicvirtualobjectBinaryOperation(BinaryOperationBinder info, objectarg); publicvirtualobject Convert(ConvertBinder info); publicvirtualobject Invoke(InvokeBinder info, object[] args); publicvirtualobjectInvokeMember(InvokeMemberBinder info, object[] args); publicvirtualobjectCreateInstance(CreateInstanceBinder info, object[] args); publicvirtualobjectGetIndex(GetIndexBinder info, object[] indices); publicvirtualobjectSetIndex(SetIndexBinder info, object[] indices, object value); publicvirtualobjectDeleteIndex(DeleteIndexBinder info, object[] indices); publicMetaObjectIDynamicObject.GetMetaObject(); }
Demo Dynamic Capabilities in C# 4.0
Summary • The Dynamic Languages World • The Dynamic Language Runtime • Dynamic Languages on Everyday Tasks • The Future: Dynamic Capabilities in .Net 4.0 • Try it yourself: http://blogs.microsoft.co.il/blogs/shayf
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.