Going Ruby: Straight to IronRuby? - ruby

I just started to learn Ruby and as a .Net developer, I'm wondering if I should just go straight ahead and use IronRuby, without trying some pure Ruby first.
What do you think? Will I be missing anything?
-- rauchy

I would use pure ruby (Matz Ruby Interpreter (MRI)) to start off. My understanding is that iron ruby is not quite ready yet.
If you are looking for a good book my current favorite (over pickaxe) is http://www.amazon.com/gp/product/0596516177 by matz and flanagan, the book is very concise well written paragraphs and they provide great examples (in 1.8.* and 1.9)
Enjoy! :D

Use pure Ruby first, IR isn't quite finished yet. Check out http://poignantguide.net/ruby/ - even though it's quite strange, it's a very good introduction

Ruby has a somewhat unique syntax and style that you'll pick up more quickly by working with other people's ruby code. You could certainly learn this while using IronRuby just as well as in any other implementation of the ruby language. (Although, you may run into trouble with some more obscure syntax or libraries with IronRuby; it's not a 100% complete implementation, yet.)
One interesting resource for learning idiomatic ruby is http://www.rubyquiz.com/.

I know this is an old question, but I'd like to say that four years later (today), the JRuby implementation is certainly far enough advanced to be worth starting with.

Related

Writing a simple Ruby debugger

I'm thinking of writing a basic Ruby debugger (interactive). Can you direct me to some resources or projects to learn more from?
A simple introduction into debuggers: http://t-a-w.blogspot.com/2007/03/how-to-code-debuggers.html. It even has a small part using ruby hashes as an example.
I guess you mean a Ruby debugger implemented in Ruby. A good place to start would be to take a look at the introspection and reflection interfaces documented here
If you want to be a bit more adventurous you could look at the source for ruby-debug

What are some well designed Ruby projects suitable for study of coding the Ruby way?

I am starting out on Ruby and have heard that there is a 'Ruby way' of coding. What are some projects, apart from Ruby on Rails, that are suitable for study and is agreed upon as well designed?
Prawn was explicitly created to be not only a damn good PDF generation library, but also designed from the ground up as an example of well-designed, well-factored, idiomatic Ruby code. Prawn also spawned the Ruby Best Practices book and the RBP Blog.

Ruby multithreading / multiprocessing readings

Can anyone recommend any good multithreading / processing books / sites which go into detail about the intricacies of Ruby multithreading / multiprocessing?
I tried using ruby threading and basically in deadlock-free code on 1.9vm it ran into deadlocks in jruby. Yes I realize the differences are drastic (jruby has no GIL) but I wanted to know if there are strategies or set of classes for multithreaded programming in ruby that I just need to read up on.
Side note: was kinda weird going from java to ruby having to define if i want a re-enterent lock vs not.
If you use Ruby 1.9 you can try Fiber it's a big improvement in threading in Ruby
http://ruby-doc.org/core-1.9/classes/Fiber.html
http://www.infoq.com/news/2007/08/ruby-1-9-fibers
Surprisingly, the dRuby book has a chapter about DRb multithreading, and it touches some basic aspects of Ruby Multithreading. It was written by the same man who wrote dRuby/ERB, and looks pretty good.

Which ruby interpreter are you looking forward to?

There are multiple Ruby implementations in the works right now. Which are you looking forward to and why? Do you actively use a non-MRI implementation in production?
Some of the options include:
Ruby MRI (original 1.8 branch)
YARV (official 1.9)
JRuby
Rubinius
IronRuby - Ironruby.net
MagLev (Thanks Julian) Github link
MacRuby (Thanks Damien Pollet)
Maglev. It will have the speed benefit of all the optimization that has gone into a major Smalltalk VM over many, many year. Plus it will automatically persist all your data pretty much automatically so there is no more need to monkey around with Object-Relational mapping layers and so on.
Ruby 1.9 (YARV) gives us a good idea as to where ruby is headed, but I wouldn't recommend using it for production use. While it's certainly much faster than 1.8, even some parts of the syntax keep changing, so I don't think you could call it stable. It does have some interesting new features and syntax which will surely find their way into all the other implementations over time.
JRuby and IronRuby are useful in that they give ruby access to a whole range of new libraries and environments where ruby couldn't be used otherwise. I've not found much use for them myself yet, but think it's great that they exist. They may allow ruby to infiltrate corporate environments where it wouldn't otherwise be permitted. That can only be a good thing.
Rubinius and Maglev are probably the most interesting projects, but also those where their benefit to the community is likely to be furthest into the future. Rubinius may well develop into a cutting edge 'pure' VM for the ruby language, allowing ruby code to run much faster than it can now. Maglev too seems extremely promising, backed as it is by 20+ years of VM experience. It will also provide features over and beyond a standard VM, but of course these will come at the cost of code portability.
Overall though, what I'm most excited about is the competition between these implementations. Having competing projects all working to make ruby better can only make the ruby ecosystem stronger. From what I've seen too, while the competition exists it is friendly; each project giving and taking ideas from each other. The work done by the JRuby and Rubinius teams in creating a ruby spec is probably the most important outcome so far, as it will help ensure that all implementations remain compatible.
jRuby is stable and reliable today. Maglev is very promising.
No one mentioned MacRuby yet? I guess it's a bit Mac-specific now, but it could probably be made to compile to the GNU or Étoilé objective-c runtimes too.
Also, I'm waiting for Maglev :)
What about Enterprise Ruby? This has been out there for a while.
https://www.phusionpassenger.com/enterprise

Continuations in Ruby

Has anyone ever done work to get Ruby to do continuations (like Seaside on Smalltalk)?
Yes, in most cases. MRI (1.8) have supported them as far as my memory reaches, Ruby 1.9 (YARV) does it, too, so does Rubinius. JRuby and IronRuby don't have continuations, and it's quite unlikely they will get them (JVM and CLR use stack-instrospection for security)
Ruby as a language supports continuations via callcc keyword. They're used, for example, to implement Generator class from standard library.
continuations on ruby-doc
Continuation-based web frameworks (like seaside, or one from Arc's std. library) seem less popular. I've found wee that claim to let you do optional continuations, but I've never used it.
As others have said already, Ruby 1.8 supports continuations.
Ruby 1.9 has not supported them for a while however. They have been added back some time this year, but most of the other Ruby interpreters (JRuby, IronRuby, etc) don't support them.
If you want your code to be usable on other platforms than the mainline Ruby, I'd suggest not using them.
Read this InfoQ article for a more comprehensive discussion on the topic.
Btw this is an example of restartable exceptions (aka conditions) implemented using continuations. I used it few times and it's a cool thing to have in a Ruby toolbox.
neverblock uses 1.9 fibers for a single threaded ruby web server

Resources