Dynamic languages for .NET CLR
Upcoming SlideShare
Loading in...5
×
 

Dynamic languages for .NET CLR

on

  • 1,213 views

 

Statistics

Views

Total Views
1,213
Views on SlideShare
1,213
Embed Views
0

Actions

Likes
0
Downloads
10
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Dynamic languages for .NET CLR Dynamic languages for .NET CLR Presentation Transcript

  • 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
  • Briefly Changing types at runtime No types at all Generate code at runtime Simplified deployment
  • Where Dynamic Languages fit Rapid prototype development Better string processing capabilities
  • 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
  • Dynamic Languages on .NETIron Python Iron Ruby C# Others… Dynamic Language Runtime .NET CLR
  • Is C# dynamic language..? Yes..optionally.. New dynamic keyword in C# 4.0
  • 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
  • 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
  • DLR Website http://dlr.codeplex.com/
  • 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
  • Current Status DLR 1.0 Iron Python 2.7.2.1 IronRuby 1.1.3
  • IronPython IronPython Website http://ironpython.codeplex.com/
  • 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
  • Tools to Develop IronPython Python Tools for Visual Studio http://pytools.codeplex.com/
  • Iron Python Shell
  • 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
  • ASP.NET Iron Python http://aspnet.codeplex.com/wikipage?title=Dynam ic%20Language%20Support Demo
  • What about Linux  Iron Python can run on Linux  Mono
  • 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
  • Dynamic Languages in Java Java 223 Specification Jython
  • Real world example http://Ironserver.codeplex.com