John Lam 1997 — 2026

Why Ruby rocks for DSLs

I just did a quick hack tonight to test out some ideas for generating a CLR DynamicMethod from Ruby. Here’s what I was able to accomplish:

include ILGenerator
create_ruby_method('say_hello') do
ldstr    'Hello, World'
call     'static System.Console.WriteLine(System.String)'
ldc_i4_4
ret
end
say_hello

Is that syntax lovely or what?