Navigation

Search

Categories

 

On this page

[DDD6] Why IronRuby? with Dave Verwer

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 8
This Year: 2
This Month: 0
This Week: 0
Comments: 6

Sign In
Pick a theme:

 Sunday, November 25, 2007
Sunday, November 25, 2007 12:39:59 AM (GMT Standard Time, UTC+00:00) ( )

Dave Verwer

Ruby had the first beta in 1995

Iron Ruby is branched from 1.8.x branch of ruby modulo
DLR is just a layer on top of the CLR, still compules to IL
IronRuby is a blind implementation for clean IP
ruby bridge by john lam was an early use of the CLR in Ruby
the DLR came out of IronPython work
IronRuby has two developers working on it at microsoft
rubyforge subversion repository is a mirror of  the internal microsoft codebase
you can run regular ruby code in IronRuby

Optional Punctuation
semi colons, returns, braces, etc.
you can determine which puntuation you need to make your code readable
immutable string declarations are done like :init which is the string "init"
immutable strings are never disposed

Syntactic sugar
Optional Punctuation makes Domain Specific Languages more forgiving for syntax and easier to write
Sigils prefixing variable names to add description
Sigils include local, $global, @instance, @@class, Constant
sigils determine scope and are optional
ruby strongly typed but can redeclare vars
shorthand Range.new(1,100) 0..100
%w(words in an array) will create an array that is seperated by spaces
using an immutable string as a hashtable key can cause collisions
puts var unless x.nil?  this will handle null cases
strings can be single or double quotes and nest the other type without using escape characters (when its mixed you need them though)
theres no character type natively but you can use the .Net Char type
big numbers can be assigned dynamically you don't need to worry about exceeding the maximum value
no native decimal type support but you can use the .net decimal type
can alias methods on a class level so you don't have to program in american
blocks in ruby are lambda methods,anonymous delegates in c# and closures in js
core language contruct - heavy use of delegates
there are no for loops you just use the times block

a for loop
10.times do {print "Hello"}   this print Hello 10 times

a foreach loop
["a","b"].each do |letter|
  puts letter
end

file.each_line do |line|
  line =~ /regex/
end

a try catch
begin
  ...
ensure
  ...
end

yield keyword exists like c#
=== is the match operator and compares as well as it can

mixed matching in case statements
case i
  when MyClass
    ...
  when 1..100
    ...
  when /^[a-z]*$/
    ...
end

Mixins
like c# extension methods
String.module_eval do

you can redefine a class to override or add a mixin

  class String
    def capitalize_all
   ...
 end
  end
 
  class String
    undef length
  end
  
Linguistics library in ruby (blew my mind, not hard to do just nice to have done for you already)
 
individually extend instances of objects

in.extend(JPEGMethods)  

class ReverseString
  def method_missing(method_name)
    ...
  end
end

method_missing is used to do dynamic querying of database based on what the current class is and that its trying to do a find
 
customer.find_by_email_or_name

this makes intellisense a hard problem
naming is underscore seperated and lowercase
name mangling allows the CLR namespaces to be available with Ruby naming conventions

Thanks Dave

Comments [0] | | #