JRuby with Ruby 1.9 - ruby

I know there is ongoing work for in this regards but what is the exact status of JRUby 1.3 compatibility with Ruby 1.9.1 ? I am slightly confused if I can dwnload jruby 1.3 and start working with my ruby 1.9 installation.
The JRuby homepage says :
* Ruby 1.8.6 compatible now
* Ruby 1.9 compatible soon
Wikipedia says the following:
Release history
This table present only releases that present significant steps in JRuby history, aside from versions that mainly fixed bugs and improved performance.
Release Release Date Highlights
0.9 2006-08-01 Rails support[11]
1.1 2008-03-28 Performs better than Ruby MRI 1.8.7[6]
AOT mode and JIT mode[21]
1.1.4 2008-08-28 Refactored Java integration layer
Beginning of Ruby 1.9 support
FFI subsystem for calling C libraries[22]
1.2.0 2009-03-16 Ruby 1.9 support almost complete (including JIT compiler)
Preliminary Android support

A detailed overview of what is done and what is missing can be found on their wiki. From that page:
These are entire areas that need to be worked on.
Encoding::Converter
Yielder/Generator
key Marshal changes
cli options
some RubyBignum changes
possible other changes in Numerics
changes in Dir/IO/File (some obvious things are done, like enumeratorize)
some changes in Math
encoding information in exception messages (now passed via java String)
BigDecimal changes ?
In general, though, I think you'll be fine if you use JRuby for Ruby 1.9 code. Any errors that you may have will be few and far between, and easily fixable (for the most part). I recommend you try your code with the latest JRuby, and if it doesn't work, then you know not to use it yet.

Update to 1.6.4 and you'll get JRuby 1.9 with the --1.9 flag, or with the JRUBY_OPTS environment variable set to --1.9.

Here's an update from the 11/2/2009 release notes for Jruby 1.40:
We have also gotten more serious about
out 1.9 support (–1.9). The bigger
applications mostly just work at this
point, but we still have a ways to go
on 1.9 support. Please try your 1.9
code in JRuby and help us firm things
up.
Having struggled with Rails when it almost worked under JRuby, I'd advise sticking with 1.8x for now if you're doing production work. The JRuby guys are great, and I'm sure they'll nail 1.9, but in the meantime, living on the edge is painful when you're trying to get things done.

Related

Can I use Ruby 2.4 code in Ruby 3 without getting any error?

I was wondering if I could use codes based on ruby 2.4 in ruby 3 (as in the programs, methodology, syntax and function names). I would like to slowly migrate to Ruby 3, but I would like to know if everything would be stable.
Do I need to download some package to make it stable? Is Ruby 3 backwards compatible (i heard they are not that much as they are fast innovator's, let's say compared to python which has backwards compatibility for all versions of 3.x but not that much of an innovator)?
Should I go through everything that I have written to make it compatible?
A bit of a tangent, but would it even be necessary for me to migrate to Ruby 3? I would presume that Ruby 2.4 already has enough features and updates for now for me to continue using it, and if I do not go up a version, I can always use Ruby 2.7.
Thanks!
The short answer is pretty No.
You will have as many compatibility issues as many legacy code you have.
Try to reach some resources like https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
But still, If you have well-written tests, they will fail, and deprecation warnings will occur. Those will be some kind of map for you(by fixing issues) to reach a new version.

What is ruby-build-github?

What exactly is ruby-build-github, and why should I use it instead of the normal ruby builds?
I came across it while looking into installing Jekyll and using Github Pages.
It makes it easy to install github's fork of ruby (either with rbenv or on its own).
Github's ruby doesn't vary dramatically from "normal" MRI - it's largely backports of things that will be released as part of normal ruby later on.
Github seem to roll out new versions of ruby quite aggressively (according to this [gist]https://gist.github.com/tmm1/8393897) they were running 2.1.0 in production only a fortnight or so after it was released and had run into some of the sharp edges you might expect to encounter.
In general you would have to take a view as to whether you were interested in any of the patches they had applied to mainline ruby, which will of course vary over time

Faraday: you may want to install system_timer for reliable timeouts

I migrated an old script to a new CentOS box and got the following message when running the script:
Faraday: you may want to install system_timer for reliable timeouts
Is it a warning and what is system_timer? A gem?
It is a gem.
You should not need it any more, though, as it only supports Ruby 1.8 and older (and Ruby 1.8 is officially deprecated).
From http://ph7spot.com/musings/system-timer:
Update: system_timer is only relevant if you are running Ruby 1.8. You do not need it if you are running Ruby 1.9, JRuby, Rubinius or MacRuby. Actually using system_timer with one of these Ruby interpreters would not even make any sense since, as explained in this article, system_timer is designed to workaround a fundamental limitation of the threading implementation in Ruby M.R.I. 1.8 (green threads). All other Ruby interpreters use native threads and timeout.rb should work as expected as long as the global interpreter lock is released.

Learning Ruby - 1.8 or 1.9 version?

I've been learning Python for a while, but the projects I want to do are better suited for Ruby, for example the SAC API for CSS is available in Ruby (and C & Java).
Anyhow, which version of Ruby should I learn right now considering that I'll be building only web apps.
Thanks for your comments and advices.
(Just) because you are planning to build web apps, Ruby 1.8.7 seems to be the most appropriate version for the following reasons:
The Rails ecosystem has still some problem with Ruby 1.9
Ruby Enterprise Edition is based on Ruby 1.8.7 and this is the Ruby interpreter you are likely to use in production unless you don't use jRuby
jRuby is based on Ruby 1.8.7, if you plan to use it
However, you should always keep in mind that Ruby 1.9 is the future. So, avoid using Ruby 1.8.7 deprecated features and you should definitely have a look at the Ruby 1.9 roadmap.
Avoid Ruby 1.8.6. The upcoming Rails release (Rails 3) won't work with Ruby 1.8.6.
Hands down, go with 1.9. There's not that much of a difference if you're a web developer just starting out with Ruby. And by the time you get to the point where the version nuances matter, everything will be on 1.9.
i think you can start in 1.9
its more better..
its nearest future

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.

Resources