Which ruby interpreter are you looking forward to? - ruby

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

Related

Use JRuby for Ruby web applications? Is it worth it?

Background: I'm writing a 'standard' (nothing special) web application in Ruby (not Rails) and I need to start thinking about deployment.
So I've been hearing a lot of recommendations to use JRuby to deploy Ruby web applications, regardless of whether you actually need Java libraries or not. How true is this? Is it worth using the Java implementation just for speed? Would I gain anything else by doing so? Would I run into any issues?
PS: I don't know Java that well, so "you can write parts of it in Java" isn't very helpful.
JRuby is one of the most complete ruby implementations (there are a lot other ones out there such as IronRuby, Maglev, Rubinius, XRuby, YARV, MacRuby). It is very comprehensive, therefore, unless you use gems that use native C code, you will very very likely be just fine compatibility-wise.
JRuby is a bit faster than the actual C implementation, but it supports actual threads, whereas the official implementation is struggling a bit into getting it (it still uses Green Threads). Using Java threads from JRuby is quite trivial, even though it will require you to couple your code with Java (with a little DI, this coupling will only happen once, though).
Another benefit: runtime tools. Java, as a platform, instead of a language, has a lot of runtime tools to help you diagnose problems and check the state of the application (profilers, JConsole, and so on).
Twitter engineers also mentioned that the Ruby VM kinda has trouble being an environment for long lived processes, while the JVM is very good at that, because it’s been optimized for that over the last ten years.
Ruby also had a little security issue recently, which did not affect JRuby's implementation.
On the other hand, your project requires more artifacts (JVM, JRuby jars, etc). If you are using an application that will stay alive for long, and you want better runtime support, JRuby can be a great way to go. Otherwise, you can safely wait until you need these things to actually make the move (it is likely to go smoothly).
I use and love JRuby on daily basis, but I suggest you use MRI (a.k.a. C-Ruby) unless you have a actual need for JRuby.
Reasons for using JRuby:
Java integration
Restricted environment (your machine has Java installed by not ruby and you don't have root)
Restricted environment (you have ruby installed but don't have root so can't install gems you need)
You reached the limits of Ruby 1.8 performance and cannot use 1.9
From what you've described, you don't have any of the above reasons.
C-Ruby 1.9 has significant performance improvements over C-Ruby 1.8. I've yet to read (or find out for myself) how C-Ruby 1.9 compares with JRuby 1.8 or JRuby 1.9. In anycase, you don't have a performance problem (yet) so don't worry about it.
The good news is, you can start with either and convert later if needs be. It's all Ruby, and the Webrick and Mongrel gems work with both.
As mentioned above, ruby gems that have C extensions cannot be installed under JRuby. Hopefully this will change in the future if ruby C extensions utilize FFI.
http://kenai.com/projects/ruby-ffi/pages/Home
http://isitjruby.com/

What is the significance for Ruby programmers of SAP's new implementation of Ruby?

SAP announced Blue Ruby, a version of Ruby that runs inside the ABAP Virtual Machine.
This seems to lend additional credibility to the Ruby language but, except for SAP developers, does this have any applicability to the rest of the Ruby community?
I'm just wondering what other significance this may have. Additional job opportunities, perhaps, for Ruby developers to be hired to work on SAP projects?
Any other potential benefits for Ruby programmers?
Also, something I'm not clear about: Besides MRI and JRuby, how many different implementations are there and why do I, as a Ruby programmer, need any implementation except the MRI? I understand I might need JRuby if I want to integrate with Java libraries. Are there any other times I might need to look into an implementation besides the MRI or JRuby?
I notice that Blue Ruby is compiled. Is that a big benefit and would this be the first compiled version of Ruby?
Sorry - maybe too many questions but this is being discussed as a big deal except I'm not sure why/if it really is. Would be grateful to get some feedback from people who understand Ruby (and I.T.) better than I do.
There are actually quite a few alternative implementations. The reason for so many versions is partly because while Ruby itself has a lot of fans, MRI is often considered to be not quite as nice as the language it hosts.
This is a list of all the other Ruby implementations I know of:
MRI
JRuby for Java. Its speed advantage isn't as great now that Ruby 1.9 is out, but it's still a big player for its integration with Java.
IronRuby (still in development) for .NET
MacRuby for making native Mac OS X applications. It's currently based on Ruby 1.9, but they're going to release a new LLVM-based virtual machine for the next version, which looks to offer a major speed boost and will hopefully be portable to other LLVM target platforms.
MagLev (still very much in development) for high-capacity Web apps. It will probably be a commercial product.
Rubinius is a ground-up reimplementation meant as an alternative to MRI with a much cleaner foundation.
I doubt Blue Ruby will have much of an impact on the general software development landscape. It will probably be nice for SAP programmers and allow them to cast a wider net for potential hires since Ruby is somewhat more popular than ABAP.
All of the current Ruby implementations are compiled to bytecode. Contrary to SAP's claims, as of Ruby 1.9, MRI itself includes a bytecode compiler, though the ability to save the compiled bytecode to disk disappeared somewhere in the process of merging the YARV virtual machine. JRuby is compiled into Java .class files. I don't have a lot of details on MagLev, but it seems safe to say it will take that road as well.
Each implementation has its own use cases. JRuby is useful for much the same reasons Jython is. IronRuby will be useful in a .NET environment, when it exists in a usable state.
Things like this make Ruby more acceptable on the Enterprise level, and hasten the spread of Good Programming Languages.
Of course, Blue Ruby is intended for SAP related people. I don't think is going to have much more of an impact on the Ruby community because most Ruby developers are not related to ABAP development.
The main purpose of Blue Ruby is to bring a powerful Scripting Language into the ABAP world, providing more tools for ABAP developers.
You can read my blog on Blue Ruby providing an SE16 (Data table explorer) emulator.
https://weblogs.sdn.sap.com/pub/wlg/14222
Greetings,
Alvaro "Blag" Tejada Galindo.
Senior ABAP Consultant - SAP Mentor.

Differences between Ruby VMs

What are the advantages/disadvantages of the major Ruby VMs (things like features, compatibility, performance, and quirks?) I know there are also some bonus features like being able to use Java interfaces through JRuby, too. Those would also be helpful to note. Does any VM have a clear advantage at this point, and in what contexts?
I've used both Matz's Ruby and JRuby, and they solve different tasks. If you are developing a straight Ruby or Rails app, then that will probably suffice, but if there are some powerful Java libraries that would help a lot, then JRuby might be worthwhile.
I haven't done anything overly complicated, but JRuby seemed to match up pretty well, at least as far as implementing the core language features (I haven't run into any differences yet, but they may exist).
One little anecdote I wish to share... I was writing a script to interact with a DB2 database. The DB2 support in Ruby is abysmal... you have to install the whole DB2 express version just to be able to compile the Ruby drivers, which didn't even work for me. I got fed up and switched to JRuby, using JDBC and a few small DB2 JDBC jars. It resolved my problem perfectly. The point? Well, if gaining access to some Java libraries will simplify the problem at hand, by all means go for it!
I hope this was helpful! Sorry I don't have any experience with other VMs....
One more caveat I have read about, but I don't know the details too well... JRuby I think supports threading via Java threads, instead of the "green" threads supported in Matz's implementation... so if you want multithreading on multicore systems, JRuby will probably serve you better... unless you want to do the threading in C.
Here's a bit of info I scrounged up on the main VMs: Ruby MRI, Ruby 1.9 (YARV), JRuby, XRuby, Rubinius, and IronRuby
There was a performance benchmark last year that compared the major VMs, but with how quickly VM development has been it probably is not as relevant today. Ruby 1.9 was generally the fastest, and still has the edge over JRuby for now, I believe.
Four VMs are currently capable of running Ruby on Rails: Ruby MRI, Ruby 1.9, JRuby, and Rubinius.
XRuby runs on the JVM, as does JRuby, and compiles the Ruby source files to a Java .class.
IronRuby runs on .NET, making use of their DLR, and allows you to integrate Ruby with the .NET libraries and infrastructure. It cannot yet run Ruby on Rails.
There is also a VM called HotRuby that lets you run Ruby source code in the browser or in Flash.

What version of Ruby to learn?

I've wanted to learn Ruby for some time and even started to learn a little bit. I then got distracted and for some reason went with Python. I have now however decided that even though my current project is in Python, I will also be learning Ruby and Ruby on Rails.
If somebody were to ask me what version of Python to start with I'd suggest 2.6 because 3 breaks compatibility with all the tutorials they would google. Knowing so little about Ruby, what version should I install on my computer? Is there a major difference between any two versions etc etc?
The version you learn is not that important.
While there will eventually be a shift from the more stable 1.8.x series, 1.9 isn't game breaking in a way where you will be disadvantaged.
Rails recommends version 1.8.7, so if you're going to be learning rails, I'd stick with that. This book is pretty good.
I don't think Ruby has had that many breaking changes - except 1.9 onwards. So any version in the 1.8.x should be fine.. pick the latest stable version.
Rails on the other hand has changed dramatically in Rails 2.
If you're going to be working in Windows, go with the current most stable one-click installer. At time of writing, that would still probably be the 1.8.6-26, although 1.8.6-27 is imminent. 1.8.7 is a small increment and I'm very uncertain about the status of 1.9.1 on the platform.
On OSX or other *nix varieties I'd be prepared to be somewhat more adventurous: the current production Rails release (2.3.2) is supposed to be 1.9.1-compatible (although that may not be the case with all third-party libraries for some time) and learning might be more entertaining with the latest version. It should run a good but faster, too.
Ruby 1.9 makes a few breaking changes, but not like Python 3. Any old Ruby tutorials should work just fine for 1.9. There's nothing like, for example, Python changing print and merging range() with xrange().
It really doesn't make that much difference. The core language hasn't changed a lot — 1.9 is just a lot faster and has gained some new features.
There are some changes that broke some libraries, but those have more to do with the finer implementation details rather than what you learn in basic tutorials, so it shouldn't hurt you. If you want to go with 1.8 for the better library support, that's fine. If you want to go with 1.9 for the better core features, that's fine as well. It doesn't make that much of a difference when you're just starting off.
If you're planning on building stuff that you don't release to the public, that makes use of lots of libraries, 1.8.7 or 1.8.6. If you're writing libraries that will be released to the public, please, please, please make sure they work in Ruby 1.9. Ruby 1.9 is a superior interpreter, but we're stuck with 1.8.x because so many libraries are incompatible with it right now.
http://isitruby19.com/
Learn the latest version. Current latest version is 2.4., but when higher versions are out, go for them immediately. Ruby team pays attention to only release finished work, you don't need to be afraid to install the newest one.

Going Ruby: Straight to IronRuby?

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.

Resources