Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is one of the two things that the <a href="http://DLR.CodePlex.Com/" rel="noreferrer">Dynamic Language Runtime</a> is supposed to do: everybody thinks that the DLR is only for language implementors to make it easier to implement dynamic languages on the CLI. But, it is also for application writers, to make it easier to host dynamic languages in their applications.</p> <p>Before the DLR, every language had their own hosting API. Now, the DLR has a <a href="http://DLR.CodePlex.Com/wikipage?title=Docs%20and%20specs" rel="noreferrer">standardized hosting specification</a> that works the same for <em>every</em> language, and with support for dynamically typed objects in C# 4 and VB.NET 10, it gets easier than ever:</p> <pre><code>// MethodMissingDemo.cs using System; using IronRuby; class Program { static void Main() { var rubyEngine = Ruby.CreateEngine(); rubyEngine.ExecuteFile("method_missing_demo.rb"); dynamic globals = rubyEngine.Runtime.Globals; dynamic methodMissingDemo = globals.MethodMissingDemo.@new(); Console.WriteLine(methodMissingDemo.HelloDynamicWorld()); methodMissingDemo.print_all(args); } } # method_missing_demo.rb class MethodMissingDemo def print_all(args) args.map {|arg| puts arg} end def method_missing(name, *args) name.to_s.gsub(/([[:lower:]\d])([[:upper:]])/,'\1 \2') end end </code></pre> <p>Here you see stuff getting passed around in every possible direction. The C# code is calling a method on the Ruby object <em>which doesn't even exist</em> and the Ruby code is iterating over a .NET array and printing its contents to the console.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload