Dynamic languages for .NET CLR

1,788 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,788
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Dynamic languages for .NET CLR

  1. 1. Dynamic programming languages  In the broadest sense of the wordDynamic programming language is a term usedbroadly in computer science to describe a class of high-level programming languages that execute at runtimemany common behaviors that other languages mightperform during compilation, if at all. These behaviorscould include extension of the program, by adding newcode, by extending objects and definitions, or bymodifying the type system, all during program execution.Source: Wikipedia
  2. 2. Briefly Changing types at runtime No types at all Generate code at runtime Simplified deployment
  3. 3. Where Dynamic Languages fit Rapid prototype development Better string processing capabilities
  4. 4. Dynamic VS Static Dynamic Static Languages Languages Simple & Easy to Learn Type safety Late bound Runtime Performance Highly Expressive Compile-time checking No compilation Intelligent tools
  5. 5. Dynamic Languages on .NETIron Python Iron Ruby C# Others… Dynamic Language Runtime .NET CLR
  6. 6. Is C# dynamic language..? Yes..optionally.. New dynamic keyword in C# 4.0
  7. 7. Dynamic VS Object dynamic dyn = 1; object obj = 1; //NOT MUCH DIFFERENCE System.Console.WriteLine(dyn.GetType()); System.Console.WriteLine(obj.GetType()); dyn = dyn + 3; obj = obj + 3; // THROWS ERROR //obj = (int)obj + 3;More Readable Code
  8. 8. The Dynamic Type in C# Calculator calc = GetCalculator(); int sum = calc.Add(10, 20);object calc = GetCalculator();Type calcType = calc.GetType();object res = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 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 dynamic calc = GetCalculator(); be dynamic int sum = calc.Add(10, 20); Dynamic Dynamic method conversion invocation
  9. 9. DLR Website http://dlr.codeplex.com/
  10. 10. Microsoft Vision Implemented as Iron Languages  Iron Python, Iron Ruby All languages run on .NET runtime Easy to use .NET libraries Easy to use other .NET languages Easy to use in .NET hosts Easy to use with .NET tools
  11. 11. Current Status DLR 1.0 Iron Python 2.7.2.1 IronRuby 1.1.3
  12. 12. IronPython IronPython Website http://ironpython.codeplex.com/
  13. 13. IronPython vs CPython IronPython  Written in C#  Works with .NET VM  Produces IL code  Assemblies, Modules CPython  Written in C  Works Python VM  Produces Python Byte Code  Modules
  14. 14. Tools to Develop IronPython Python Tools for Visual Studio http://pytools.codeplex.com/
  15. 15. Iron Python Shell
  16. 16. Exploring Iron PythonDemo  Using .NET Class Libraries (HelloWorld example)  Using C# DLL in Iron Python (Extending Iron python with C#)  Embedding Iron Python in C#  Windows Forms
  17. 17. ASP.NET Iron Python http://aspnet.codeplex.com/wikipage?title=Dynam ic%20Language%20Support Demo
  18. 18. What about Linux  Iron Python can run on Linux  Mono
  19. 19. How to Contribute  Both Iron Python and DLR are open source projects  Iron Python Project will accept source code and bugs  DLR is just open source
  20. 20. Dynamic Languages in Java Java 223 Specification Jython
  21. 21. Real world example http://Ironserver.codeplex.com

×