[Ironruby-core] Trouble getting started - some basic questions
rob.s.brit at gmail.com
Sun Apr 8 15:43:02 UTC 2012
> 1. Can I write a Ruby application that uses .NET for system stuff
> (Windows, forms, networking) and package that as an installation that
> end users can install on their computer without going through the whole
> (for users) Ruby installation rigmarole? i.e. Can I write a GUI
> applications and distribute them with a few DLL's packaged and a
> requirement for .NET 4?
Yes, sorta. While you can technically just have .rb files for your app
and execute those directly, it might be easier to have a C# .exe file
and load the Ruby files from that. That way you can have an .exe for
people to open rather than them having to find the correct Ruby file.
It will also make it easier to do some of the things I mention later
in this email.
A while back I did up a little post on how to get IronRuby working
from a C# app: http://lovehateubuntu.blogspot.ca/2010/12/embedding-ruby-repl-in-net-app.html
> 2. Is the IR implementation any faster/slower than the standard?
Not sure, but if you're using Ruby for a GUI app it doesn't really
matter which version of Ruby you use: it will be slow or fast
depending on what you're doing, the difference between the different
Rubies is just noise. If a particular thing is too slow, write it in
C# and expose it to your Ruby code.
> 3. Can Ironruby use JRuby as for the VM? Or maybe that is an irrelevant
> question and I am misunderstanding how IronRuby works?
No. IronRuby is Ruby, but running in the .NET VM. JRuby is Ruby, but
running in the Java VM. C Ruby is Ruby, running in the Ruby VM. All of
the languages are the same, just running in different environments.
The difference is when you start using libraries: if you use
System.Windows.Forms, then you can't use your code in MRI or JRuby
because they don't have that library (it's a .NET library). Likewise
if you use C libraries written for MRI, you can't use JRuby or
IronRuby, and if you use Java libraries then you can't use MRI or
> 4. Is IR with Mono very bloated? I was going to use wxRuby, but it seems
> dead and I am now thinking of working in IR instead.
Ruby in general uses up a lot more memory than the equivalent C#
program, has nothing to do with using Mono or wxRuby or whatever. It's
one of the costs you pay to be able to have Ruby's expressiveness.
>From my experience converting code between IronRuby and C# it can be
as much as a 10x difference in memory usage.
> Basically I am wanting to write simple GUI stuff in Ruby to help me
> learn Ruby better and also learn a bit of .NET. I will be using Rails
> for my main server app, but I am not moving on to that until I learn
> Ruby much better. I have gotten fed up writing console apps and want a
> simple way to get some GUI going.
One thing to note: Rails is a web application framework designed for
building websites, not GUI apps. If you want to build a GUI app, then
you don't need Rails at all.
Hope this helps!
More information about the Ironruby-core