SlideShare uma empresa Scribd logo
1 de 44
IRON Languages Jimmy Schementi jschementi@lab49.com jimmy.schementi.com Dynamic Languages for the .NET developer github.com/IronLanguages
JavaScript Tcl MATLAB Ruby Smalltalk
xkcd.com
Executes many common behaviors, at runtime, that other languages might perform during compilation, if at all.
Most are dynamically-typed, but not all. Dynamic Typing The majority of its type checking is performed at run-time as opposed to at compile-time.
why?
Simple enough for non-programmers,             capable enough for programmers print File.read("foo.txt") name = "Jimmy" [1,2,3].each do |i|    puts i end class Foo defmethod_missing(m) puts "called: #{m}"   end end Foo.new.dfhajsdhfl "-" * 79 a.downcaserescue "No name"
Scripting  Languages Dynamic  Languages
“Python, like many good technologies, soon spreads virally throughout your development team and finds its way into all sorts of applications and tools…Python scripts are used in many areas of the game.” Mustafa Thamer 		Civilization IV development team
http://www.unreal.com/media/banners/kismet1.jpg
http://logo.twentygototen.org/
Interactive >>> 2 + 2 4
.NET?
Dynamic Languages on .NET Consumers
Keep it Simple Python Ruby def fact n     return 1 if n == 0     n * fact(n-1) end puts fact 13 def fact(n):     if n == 0: return 1     return n * fact(n-1) print fact(13) C# using System; public class MathClass {     public static int Factorial(int n) {          if (n == 0) return 1;          return n * Factorial(n – 1);     }     public static void Main(string[] args) { Console.WriteLine(Factorial(13));     } }
Ecosystem exchange .NET gets Python and Ruby world, and Ruby/Python gets .NET world Ruby on Rails/Django/RSpec/etc  on .NET Scripting the .NET framework Driving .NET code from scripts for testing, exploration, etc. DSL-like characteristics Hosting In-Application extensibility / customization Treating code as data (or configuration) Discussion on best practices
Scripting the .NET framework Driving .NET code from scripts Domain-specific languages Compiler Geek-Out High-level discussion on how compilers work and what the DLR does. Hosting In-Application extensibility / customization Treating code as data (or configuration) Discussion on best practices
Demo Scripting .NET
rb> puts 2 + 2     4 # => nil
traditional compiler front-end Scan Token stream def add():   return 2 + a return 2 + a Parse Syntax Tree return  add Named(a) Const(2)
IronPython:  Hand-written LL(1) parser IronRuby:  Gardens Point Parser Generator LALR(1)
compiler back-end on CLR Generate IL Syntax Tree ldc.i4.2		// load 2 box  [mscorlib]System.Int32 ldarg.0		// load “a” call  object LangHelpers::Add(object, object) ret IL return  add public static object Add    (object x, object y)  {     ...  } Const(2) Runtime Library Named(a)
compiler back-end on DLR Linq Expression Tree ToExpression Tree Return  Syntax Tree return  MethodCall LangHelpers.Add add ConvertTo Object BoundExpression Const(2) Named(a) Variable a: Object ConstantExpression 2
puts 2 + 2 -> Expression tree   .Dynamic puts(.S,1) @1(     $#scope, $#self, .Call IronRuby.Runtime.RubyOps.CreateMutableStringL(    "hi",         .Constant<IronRuby.Builtins.RubyEncoding>(US-ASCII)))
IronRuby.Runtime.RubyScriptCode internalstaticDelegate/*!*/CompileLambda( LambdaExpression/*!*/ lambda,  booldebugMode,  boolnoAdaptiveCompilation,  intcompilationThreshold) { if (debugMode) { returnCompileDebug(lambda);             } elseif (noAdaptiveCompilation) { returnlambda.Compile(); } else { returnlambda.LightCompile(compilationThreshold);             }         }
static vs. dynamic dispatch MethodCallExpression Method    : {RuntimeMethodInfo               {Name: "Print"}} Arguments : [0] ActionExpression def yo (name):      "hello " + name print yo("jimmy") ActionExpression yo("jimmy") Action    : CallAction Arguments : [0] {BoundExpression                   {Variable: Local{yo}}}             [1] {ConstantExpression {"jimmy"}}
public static object Handle ( 	object[] args, DynamicSite<object, object, object> site1, 	object obj1, object obj2) { 	if (obj1 != null && obj1.GetType() == typeof(string) &&        obj2 != null && obj2.GetType() == typeof(string))  	{ 		return StringOps.Add(Converter.ConvertToString(obj1), Converter.ConvertToString(obj2)); 	}    return site1.UpdateBindingAndInvoke(obj1, obj2); }
print yo(1)
public static object Handle ( 	object[] args, DynamicSite<object, object, object> site1, 	object obj1, object obj2) { 	if (obj1 != null && obj1.GetType() == typeof(int) &&        obj2 != null && obj2.GetType() == typeof(int))  	{ 		return Int32Ops.Add(Converter.ConvertToInt(obj1), Converter.ConvertToInt(obj2)); 	}    if (obj1 != null && obj1.GetType() == typeof(string) &&        obj2 != null && obj2.GetType() == typeof(string))  	{ 		return StringOps.Add(Converter.ConvertToString(obj1), Converter.ConvertToString(obj2)); 	}    return site1.UpdateBindingAndInvoke(obj1, obj2); }
System.Dynamic.DynamicObject
Dynamic Language Runtime Infrastructure for creating  languages Focus on dynamic compiler back-end. Dynamic-lookup protocol DynamicObject: shared protocol between languages Lightweight hosting API One API for all DLR languages
Hosting Hosting ScriptRuntime ScriptScope ScriptEngine ScriptSource
var engine = Ruby.CreateEngine(); engine.Execute("puts 2 + 2");
var engine = Python.CreateEngine(); dynamicscope = engine.CreateScope(); scope.page= this; engine.Execute("page.Message.Text = 'Hello from Python!'",  scope);
var runtime = ScriptRuntime.CreateFromConfiguration(); var engine = ScriptEngine.CreateEngine("IronRuby"); dynamic scope = engine.CreateScope(); scope.page = this;engine.Execute("page.Message.Text = 'Hello from IronRuby!'", scope);
require 'IronPython'require 'Microsoft.Scripting'include Microsoft::Scripting::Hostinginclude IronPython::Hostingpython = Python.create_enginescope = python.create_scopepython.execute "class Foo(object):    def bar(self):        print 'Look ma, white-space-sensitivity!'", scopepython.execute "Foo().bar()", scope
# foo.py:class Foo(object): def bar(self):     print 'Look ma, white-space-sensitivity!' # bar.rb:foo_module = IronRuby.require 'foo' foo_module.foo.bar
Demo Hosting
Hosting best-practices Store scripts where you want with PlatformAdaptationLayer Makes script file-system operations use database, source-control, whatever … Pick isolation level for scripts In-App-Domain: you totally control Out-App-Domain: limit permission level Out of process: total isolation
Project Status IronRubyis working towards 1.9 compat – Rails 3, FFI, static type system integration IronPythonworking towards 2.7/3.0 compat – Django, IronClad, and other libraries. Tooling IronRuby Gems/Rake support Debugging w/REPL Fully open source Contributions welcome!
How you can participate Use it  at your company, and tell us about it! Ask the mailing lists and stackoverflow for help Log any bugs you find Contributing to the project Even if you’re not a compiler hacker …  but hackers welcome! samples, documentation, blogs, and talks are all welcome also
ironruby.netIronRuby website & download ironpython.netIronPython website & downloaddlr.codeplex.comDLR documentation for hosters and language developersjimmy.schementi.comme
?

Mais conteúdo relacionado

Mais procurados

The D Programming Language - Why I love it!
The D Programming Language - Why I love it!The D Programming Language - Why I love it!
The D Programming Language - Why I love it!
ryutenchi
 

Mais procurados (20)

Go. Why it goes
Go. Why it goesGo. Why it goes
Go. Why it goes
 
Fall in love with Kotlin
Fall in love with KotlinFall in love with Kotlin
Fall in love with Kotlin
 
Golang
GolangGolang
Golang
 
D programming language
D programming languageD programming language
D programming language
 
The D Programming Language - Why I love it!
The D Programming Language - Why I love it!The D Programming Language - Why I love it!
The D Programming Language - Why I love it!
 
TypeProf for IDE: Enrich Development Experience without Annotations
TypeProf for IDE: Enrich Development Experience without AnnotationsTypeProf for IDE: Enrich Development Experience without Annotations
TypeProf for IDE: Enrich Development Experience without Annotations
 
Optimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with TruffleOptimizing Communicating Event-Loop Languages with Truffle
Optimizing Communicating Event-Loop Languages with Truffle
 
Introduction to Programming in Go
Introduction to Programming in GoIntroduction to Programming in Go
Introduction to Programming in Go
 
Csp scala wixmeetup2016
Csp scala wixmeetup2016Csp scala wixmeetup2016
Csp scala wixmeetup2016
 
Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...Asynchronous single page applications without a line of HTML or Javascript, o...
Asynchronous single page applications without a line of HTML or Javascript, o...
 
DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright DConf 2016: Keynote by Walter Bright
DConf 2016: Keynote by Walter Bright
 
Take Flight - Using Fly with the Play Framework
Take Flight - Using Fly with the Play FrameworkTake Flight - Using Fly with the Play Framework
Take Flight - Using Fly with the Play Framework
 
Introduction to Programming Bots
Introduction to Programming BotsIntroduction to Programming Bots
Introduction to Programming Bots
 
A quick and fast intro to Kotlin
A quick and fast intro to Kotlin A quick and fast intro to Kotlin
A quick and fast intro to Kotlin
 
Making Java Groovy (JavaOne 2013)
Making Java Groovy (JavaOne 2013)Making Java Groovy (JavaOne 2013)
Making Java Groovy (JavaOne 2013)
 
2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws
 
Android antipatterns
Android antipatternsAndroid antipatterns
Android antipatterns
 
R ext world/ useR! Kiev
R ext world/ useR!  KievR ext world/ useR!  Kiev
R ext world/ useR! Kiev
 
A Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and UnderstandingA Type-level Ruby Interpreter for Testing and Understanding
A Type-level Ruby Interpreter for Testing and Understanding
 
Lua Study Share
Lua Study ShareLua Study Share
Lua Study Share
 

Destaque

jimmy hacking (at) Microsoft
jimmy hacking (at) Microsoftjimmy hacking (at) Microsoft
jimmy hacking (at) Microsoft
Jimmy Schementi
 
Ratio Analysis of Apex Adelchi Footwear Ltd
Ratio Analysis of Apex Adelchi Footwear LtdRatio Analysis of Apex Adelchi Footwear Ltd
Ratio Analysis of Apex Adelchi Footwear Ltd
Moin Sarker
 

Destaque (6)

jimmy hacking (at) Microsoft
jimmy hacking (at) Microsoftjimmy hacking (at) Microsoft
jimmy hacking (at) Microsoft
 
EARN FROM HOME
EARN FROM HOMEEARN FROM HOME
EARN FROM HOME
 
Fort Meade Soundoff, Feb 13, 2014
Fort Meade Soundoff, Feb 13, 2014Fort Meade Soundoff, Feb 13, 2014
Fort Meade Soundoff, Feb 13, 2014
 
Ratio Analysis of Apex Adelchi Footwear Ltd
Ratio Analysis of Apex Adelchi Footwear LtdRatio Analysis of Apex Adelchi Footwear Ltd
Ratio Analysis of Apex Adelchi Footwear Ltd
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI Explainer
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 

Semelhante a Iron Languages - NYC CodeCamp 2/19/2011

Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
intelliyole
 
Dynamic languages for .NET CLR
Dynamic languages for .NET CLRDynamic languages for .NET CLR
Dynamic languages for .NET CLR
py_sunil
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)
Vitaly Baum
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
David Padbury
 

Semelhante a Iron Languages - NYC CodeCamp 2/19/2011 (20)

PIL - A Platform Independent Language
PIL - A Platform Independent LanguagePIL - A Platform Independent Language
PIL - A Platform Independent Language
 
Specialized Compiler for Hash Cracking
Specialized Compiler for Hash CrackingSpecialized Compiler for Hash Cracking
Specialized Compiler for Hash Cracking
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
 
Building High Perf Web Apps - IE8 Firestarter
Building High Perf Web Apps - IE8 FirestarterBuilding High Perf Web Apps - IE8 Firestarter
Building High Perf Web Apps - IE8 Firestarter
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Dynamic languages for .NET CLR
Dynamic languages for .NET CLRDynamic languages for .NET CLR
Dynamic languages for .NET CLR
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNextMicrosoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext
Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext
 
IronPython and Dynamic Languages on .NET by Mahesh Prakriya
 IronPython and Dynamic Languages on .NET by Mahesh Prakriya IronPython and Dynamic Languages on .NET by Mahesh Prakriya
IronPython and Dynamic Languages on .NET by Mahesh Prakriya
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
 
PDC Video on C# 4.0 Futures
PDC Video on C# 4.0 FuturesPDC Video on C# 4.0 Futures
PDC Video on C# 4.0 Futures
 
Fast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCFast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPC
 
Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)
 
TechDays - IronRuby
TechDays - IronRubyTechDays - IronRuby
TechDays - IronRuby
 
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Iron Languages - NYC CodeCamp 2/19/2011