Ruby'NET - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Ruby'NET

Description:

June 2006. 0.5. First public release. 2005. 0.0. Project Started at QUT. TODO ... Bug fixing. Links. ACSC08 Ruby.NET Design Paper: ... – PowerPoint PPT presentation

Number of Views:80
Avg rating:3.0/5.0
Slides: 22
Provided by: way575
Category:
Tags: net | ruby

less

Transcript and Presenter's Notes

Title: Ruby'NET


1
Ruby.NET
  • Dr Wayne Kelly
  • Queensland University of Technology

2
Ruby Implementations
  • Matzs Ruby Interpreter (MRI)
  • Yet Another Ruby VM (YARV)
  • JRuby
  • RubyCLR
  • Ruby.NET
  • IronRuby

3
Ruby.exe and RubyCompiler.exe
.NET exe or dll
Ruby Source files
Ruby Source files
Native CodeExecution
.NET exe or dll
RubyCompiler.exe
Ruby Source files
JIT
Ruby.exe
.NET exe
Native Code Execution
Ruby Source file
JIT
memory stream
4
Architecture
RubyRuntime.dll (Compiler Infrastructure
built-in classes and modules)
RubyCompiler.exe
Ruby.exe
msbuild Task
PERWAPI.dll
Visual Studio Ruby.NET Package
SymbolWriter.dll
5
Implementation Issues
  • Lack of Formal Specification
  • Scanning and Parsing

6
Interpreting vs. Compiling
  • Traditionally
  • Determine what to do
  • Perform the action
  • Compiling faster at runtime than Interpreting
  • Ruby
  • Requires compilation at Runtime
  • Highly dynamic semantics
  • Consider expression x 2

7
Mapping Ruby to the CIL
  • Ruby has objects, classes and methods
  • CIL has objects, classes and methods

?
8
Dynamic Ruby Semantics
  • Firstly the good news
  • All Ruby objects belong to a class and that class
    cannot change.
  • The super class of a Ruby class cannot be
    changed.
  • The bad news
  • The set of instance variables and methods of a
    class can change at runtime.
  • Variables and expressions are not typed.
  • Therefore dont know type of receiver in method
    calls
  • Therefore don't know which method is being called
  • Unfortunately everything in Ruby is done via
    method calls!

9
Ruby.Class vs System.Type
  • Can't even create CLI classes at Runtime
  • So, in general, Ruby class ! CLI class
  • Ruby.Class object
  • Points to super class object
  • Maps method names to methods

method
Parent Class
method
method
Ruby Object instance variables
Ruby Class class instance variables
method
method
method
10
Invoking Ruby Methods
  • object Eval.Call(object recv, string method_name,
    object args )
  • Determine the Ruby class of the receiver
  • Determine the Ruby method currently bound to the
    specified method name for that Ruby class
  • Invoke the found Ruby method

11
Ruby Objects
  • "Most" Ruby objects inherit from CLI class
    Ruby.Object
  • But we don't rely on this

12
Instance Variables
  • Normally fields of a specific class
  • Since the set of instance variables is dynamic,
    we use a dictionary to store instance variables
  • Dont need objects of specific class
  • Can use Ruby.Object in most cases
  • Some classes such as Ruby.String are special
  • For interop want to create specific classes
    where possible.
  • How do we allocate instances of a class?
  • Dont statically know super class

13
Local variables and blocks
  • Set of local variables is known statically
  • But, they may be captured
  • therefore generally cant use CLI locals.
  • def foo(a)
  • b a 4
  • bar x return a x b
  • end

14
Dynamic Evaluation
  • eval invokes compiler at runtime
  • Generates a CLI assembly to a memory stream
  • Dynamically loads it and invokes a method using
    reflection.
  • eval may be evaluated in a different runtime
    context encapsulated by Binding object

15
Dynamic locals
16
Non-local control flow
Blocks as loop bodies
17
Continuations
18
ObjectSpace andWeak References
19
Current Status and Future Plans
20
TODO
  • Extending Ruby/.NET interop
  • Performance Optimization
  • Threads and Continuations?
  • Ruby on Rails
  • Bug fixing

21
Links
  • ACSC08 Ruby.NET Design Paper
  • http//eprints.qut.edu.au/archive/00009097/01/Ruby
    .NET_Design_Paper.pdf
  • Public source repository
  • http//code.google.com/p/rubydotnetcompiler/
  • Discussion email list
  • http//groups.google.com/group/RubyDOTNET
  • RubyDOTNET_at_googlegroups.com
  • Dr Wayne Kelly, QUT
  • w.kelly_at_qut.edu.au
  • 3138 9336
Write a Comment
User Comments (0)
About PowerShow.com