Opinions on Ruby Versions?

Hi y’all

I’m doing a rewrite of my Listview class, and I’ve hit a snag.
Apparently, Ruby v1.8 doesn’t keep its hashtables ordered, but Ruby 1.9
has fixed this problem.

Should I require that users use Ruby1.9 minimum?

Here’s my problem:

@cols = {}
@cols[:join] = VR::Calendar
@cols[:name] = DataObject
@cols[:quote] = VR::TextCol
puts @cols.keys.inspect => :join, :quote, :name (wrong order!)

This is a problem because my rows appear out of order in the listview.

I know I can write code to keep track of column numbers, but
that does me no good because users of this class would need to write
similar code to use my class each time they use it (no good!).

As far as I know, there is no way to fix this, except insist on v1.9.

The problem with 1.9 is that some people (like me) use 1.8. Also,
Ubuntu, among others still automatically install 1.8. Windows has an
installer for 1.9 available. I don’t know anything about the Mac.

I would just HATE to have my install instructions say, “Install RVM…”,
or Upgrade to Ruby 1.9. Uuuuhgh!

Any thoughts?

Thanks,
Eric

hi Eric,

i mostly use 1.9.3 now, but i used (and still do) 1.8.7 extensively,
and yes - i think ubuntu still defaults to 1.8.x - but it also has 1.9.1
available…

i don’t think that requiring a 1.9.x version is such a big deal…
ordered hash tables are nice, and it’s a trade-off like you say.

just my two cents…

  • j

Hi Eric

I still use ruby 1.8 but I am starting to write code with ruby1.9 and
breaking compatibility.

Concerning your order issue did you think of using Array or Struct
object ?
You did not explain why you need symbols to access your data.
Struct elements can be accessed by symbols and I believe they are
ordered.
This last point needs to be checked.

I appreciate your input.

But my question really is:

How many people are now using ruby 1.8.x?

The situation I’m trying to avoid is somebody wanting my program who has
ruby 1.8. Then they may not want to hassle with upgrading ruby, or go
through “install hell.” (I was there today in fact:) )

Yours,
Eric

Just for your information.

In ruby world it seems that only Hash and Array classes are used.
Here are other classes that can be interesting in some cases:
Set, OpenStruct, Struct.

I discover them very recently. If you know some more, please share.

Hi Vincent:

Thanks for your response. I looked at the Struct class, and it looks
very interesting. I will definiately use it in my code in the future.

The issue I’m having is that I’m making a listview class for others to
use. So, the syntax is really important. I need to work with classes
that people already know well like hash and array. I’m feeding my
listview column definitions in the constructor:

view = VR::ListView.new( :name => String, :date => VR::Calendar)

So hashes are a perfect match. But then my listview’s columns are
randomly ordered because the hash bones me.

I’ve switched to 1.9, and it fixed it.

Thanks for all your great work, I’ve been reading your posts.

Eric

Hi fer_f. Thanks for the info.

So, how long do you think it will take for people to be using 1.9? If
the beta version of ubuntu uses 1.8, then I guess that people won’t be
transitioning for a long time. That would suck. I just posted that
visualruby requires version 1.9.

My program actually crashes with 1.8 because my hashtables are out of
order.

Eric

Hi

When packaging your application for a distribution (debian ubuntu), you
can
depend on ruby 1.9 and not the default version.
I guess/hope wheezy+1 will get 1.9 as default.

The fact is that even with “Ubuntu Precise
Pangolin”:Ubuntu – Error (still beta) or
“Debian Sid”:Debian -- Details of package ruby in sid (always beta :-), the
ruby package uses Debian’s default Ruby version (currently 1.8.x).

Yes, you can install the “ruby 1.9” package, but what people get when
they do “apt-get install ruby” is ruby1.8, so there’s a lot of people
using it.

Le Sun, 25 Mar 2012 20:32:33 +0200,
“Eric C.” [email protected] a écrit :

So, how long do you think it will take for people to be using 1.9?
If the beta version of ubuntu uses 1.8, then I guess that people
won’t be transitioning for a long time. That would suck. I just
posted that visualruby requires version 1.9.

Afaik, debian and its derivative will use 1.8 for several years.
However, they provide 1.9 as well. the naming might be confusing
though. The “nosuffix” ruby is 1.8, and the “1.9.1” suffix is for
1.9.x . And it’s unlikely they will change this as this would break
running system without any benefit.

If I’m not mistaken :

  • With 1.9 :
    Windows
    Debian (Ubuntu/Mint) (package ruby1.9.1)
    Archlinux
    Fedora 17

  • Without 1.9
    Fedora 16
    RHEL 4,5,6 (CentOS, Scientific)

I dont use other distributions.

So yes, just require 1.9, it’s the present. Imo, there is no reason to
begin a new big project with 1.8 in mind.

Simon

How many people are now using ruby 1.8.x?

I am still using Ruby 1.8.x due to the Encoding issues on 1.9.x

One day I will switch in a way as to start from scratch with ruby 1.9.x
but until then, as Encoding gives me nothing I need, I am sticking to
the ruby version I am in love with - which is 1.8.x.

The situation I’m trying to avoid is somebody wanting my program who
has ruby 1.8. Then they may not want to hassle with upgrading ruby,
or go through “install hell.” (I was there today in fact:) )

If a program is offering only 1.9.x I can not and will not use it.

You must however also understand that matz has said the only ruby
version that he will support is + 1.9.x, and 1.8.x will eventually die
out sooner or later.

So I think it is ok to eventually tell people to switch to 1.9.x, and if
they dont then it is their problem.

I accept that for myself and still use 1.8.x. :slight_smile: