Dynamic Runtime - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Dynamic Runtime

Description:

Silverlight. IMHO Best IDE on the market. Shared dynamic subsystem. Standard hosting environment. Based on passing messages to objects. Full access to the CLR ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 23
Provided by: ivanport
Category:

less

Transcript and Presenter's Notes

Title: Dynamic Runtime


1
Dynamic Runtime Languages - What's it all about?
  • Ivan Porto Carrero Xero
  • http//www.xero.com/nz
  • http//flanders.co.nz/blog

2
Agenda
  • .NET as we know knew it
  • The new .NET languages stack
  • The DLR and why is it so cool ?
  • Objects
  • Duck typing
  • Extending existing types
  • Some ruby magic
  • Meta programming
  • Interop between C and Dynamic Languages

3
.NET as we knew it
C
VB.NET

Common Language Runtime
4
The new .NET stack
C
VB.NET
IronPython
Base Class Libraries
DLR Runtime
Common Type system
Security
Class Loader, GC, JIT, Execution Support
Common Language Runtime
5
The new languages stack
DLR
Frameworks
CLR
6
The DLR and why is it so cool
  • IMHO Best IDE on the market
  • Shared dynamic subsystem
  • Standard hosting environment
  • Based on passing messages to objects
  • Full access to the CLR
  • Enable fast generation of dynamic code
  • One true object

7
The DLR and why is it so cool
  • Classic implementation of a dynamic language

8
The DLR and why is it so cool
  • DLR One true object

9
Objects
  • Demo 1 Person class

10
Duck typing
  • If it looks like a duck and quacks like a
  • Demo 2 similar properties

11
Duck typing
12
Extending existing types
  • C 3.0 has got extension methods
  • Ruby supports it natively
  • Demo 4 extension methods

13
Some ruby magic Mixins
  • Simulating multiple inheritance using mixins.
  • DRY you can separate all common logic out to one
    place.
  • A little similar to an Interface and its
    implementation
  • Works with Class (static) methods too

14
Some ruby magic Mixins
  • Demo 5 Taggable mixin
  • Demo 6 Mixin with class methods

15
Ruby magic method_missing
  • Instead of throwing a NoMethodError
  • Catch all for undefined methods
  • Mostly used in delegation scenarios
  • Syntactic sugar

16
Ruby magic method_missing
  • Demo 7 Delegation scenario
  • Demo 8 Syntactic sugar

17
Metaprogramming
  • Avoiding boilerplate code
  • Taking advantage of adding methods and classes at
    runtime
  • Rails ActiveRecord is build on it
  • ie. Dataformat drives the code

18
Metaprogramming
  • Demo 9 Build classes from csv files

19
Interop C and Dyn. Lang.
  • Core types reference mscorlib
  • require mscorlib
  • Pretty easy to build wpf apps
  • Will allow choice between asp.net webforms or
    rails framework

20
Language interop
  • Demo 10 REPL
  • extending ironruby with the C implementation of
    minutes.ago
  • Demo 11
  • Rss reader in WPF.

21
References
  • http//www.ironruby.net/
  • http//rubyforge.org/projects/ironruby
  • http//blogs.msdn.com/hugunin/
  • http//www.iunknown.com/
  • http//www.ruby-lang.org/en/
  • http//flanders.co.nz/blog

22
Questions?
Write a Comment
User Comments (0)
About PowerShow.com