Slashdot Mirror


Ruby 1.9.0 Released

sciurus0 writes "The 1.9.0 development version of the Ruby programming language has been released. This version has many changes, including a new virtual machine that provides great speed improvements."

26 of 199 comments (clear)

  1. Benchmarks mean nothing, specially these ones. by rgo · · Score: 2, Insightful

    Well, it seems that Ruby 1.9.0 is the fastest implementation available, it also is reflects the newest version of the language... but I would really like to see benchmarks based on real apps based on things like Mephisto,Radiant CMS and/or Mongrel. Also, does someone have a list with the most important features? The summary is way too poor.

    1. Re:Benchmarks mean nothing, specially these ones. by sciurus0 · · Score: 5, Informative

      According to Chu Yeow, Mongrel doesn't run on 1.9.0 yet. Neither does Rails. The release of 1.9.0 coincided with the API freeze for 1.9.x, so hopefully projects that were holding off on porting to 1.9 will do so now. The situation is complicated by 1.9's transitional nature; you should stick with 1.8 if you absolutely need stability.

    2. Re:Benchmarks mean nothing, specially these ones. by Matrix9180 · · Score: 2, Informative

      The plans are to have Rails 2.1 ruby 1.9 compatible.

      --
      120chars for a sig is teh suck
  2. Re:Why Ruby? by Anonymous Coward · · Score: 4, Insightful

    Is there any reason why I should give Ruby a try?

    Speaking as a ruby developer, if you're happy with python - not really! Python's also great. It's just a matter of which suits your style. Personally, I couldn't get over Python's syntactically significant whitespace - many people would laugh at that, but for me it's just unthinkable. So Python was just ruled out for me totally because of that.

    Python and Ruby are both competing to be the most beautiful next-gen languages .. but beauty's in the eye of the beholder. I've found mine, and it sounds a lot like you've found yours. So .. that was the long way to say, again, "not really" ! : )
  3. FFI by r6144 · · Score: 2, Funny

    Back then Ruby's C interface appeared much easier to use than Python's reference-counting mess (I don't know about recent developments). Apart from that, both are good as far as scripting languages go.

  4. Re:Why Ruby? by Anonymous Coward · · Score: 2, Insightful

    As someone in the same general situation as you -- I also work on Python code -- my conclusion when I asked myself the same question, was an emphatic no. There's little Ruby can do that Python cannot, and vice versa. As well, I looked through a Ruby tutorial; it can be a really strange language. I'm sure it works for people who put in the time to learn it, but it didn't click with my Pythonic mindset.

    I think Ruby is really an evolution of Perl. There are a lot of Perlisms in its syntax, and I bet it'd be very easy for a Perl programmer looking for something new to learn Ruby. I resisted learning Perl in the first place and picked up Python instead; I have never regretted this decision, and I don't think I'll regret not learning Ruby either.

  5. Re:Why Ruby? by Tyler+Eaves · · Score: 4, Interesting

    Ruby is a neat language. Basically imagine a language that can do all of the great hacks you can do in perl (and then some) but with a sane syntax. Python is a very very good language, I've written quite a bit of code in it. Ruby is nicer, at least from a syntax standpoint. It's just SO expressive, even beating python. But, at least until now, the speed always SUCKED balls. Maybe this new release will get it roughly on par with python.

    --
    TODO: Something witty here...
  6. Re:Why Ruby? by sciurus0 · · Score: 4, Informative

    Alright, I know this is going to be flame fodder, but I'm genuinely curious: does Ruby have anything to offer for someone who's already very proficient in Python (and Django, so Rails is already covered)?

    Take a glance at Ruby from other languages. This page highlights some of the things that make Ruby Ruby.
  7. I'd like something else. by jd · · Score: 2, Insightful
    Faster is good, but faster is not enough. Parallelization, these days, involves multi-LAN, multi-node, multi-CPU, multi-core systems where each core may or may not also be a vector processor. Modern libraries for handling such code tends to be usually too primitive to effectively handle anything but simple cases of even very narrowly-focussed software. If you want to parallelize across a combination of types, forget it. There are ways to do it - such as CORBA - but they're too slow and/or too complex. There are also languages modified to handle the complexities of parallelization, such as Unified Parallel C, Parlog or Occam, but they're usually much too complex to use in practice.

    Is parallelization the only niche that isn't supported well? No. There are other areas languages generally do badly in. There are very few languages which handle internationalization efficiently. There are very few languages which handle graphical interfaces efficiently or logically. Languages are typically either good at handling very complicated data structures OR handling structures that are defined just-in-time, typically not both.

    My interest in Ruby would be greatly increased if I saw it do something that very few other languages could do, preferably no language that was in mainstream use.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    1. Re:I'd like something else. by jd · · Score: 3, Interesting
      My BSc was over 16 years ago, my MPhil was over 11 years ago. Much of my professional career has involved client/server systems, distributed computing, grid computing, embedded computing and high-performance computing. My open source contributions include a MIPS port of an open source MPI package, work on clustering and multicast-based CORBA technology. My protocol standards contributions include work on using scalable reliable multicast alongside RDMA to do efficient one-to-all and all-to-all operations (ie: not sequentially, as is implemented in most open source MPI implementations). My hardware experience has included programming meshes of T800 Transputers, UltraSPARC clusters, Broadcom BCM1250 clusters and high-end multi-core x86 processors. Amateur projects have included using distributed computing to perform signal processing and data analysis from ground-penetrating RADAR and magnetometers being used by an archaeological group.

      If you want the evidence, the data, the background, I've no objections to stating it. Well, with the exception of commercial projects still covered by non-disclosure agreements. Even if the company betrayed not only me but also the other software engineers there, resulting in engineers being deprived of rightful wages, forced out or removed under false pretenses. I have ethics, even if they do not. The bulk of my experience is NOT covered by any NDA, but is a little on the lengthy side. People get paid good money for writing books with less content. If you actually want to know, I have no objections, but it's not something anyone would be willing to read on Slashdot as a reply or even as a main article.

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    2. Re:I'd like something else. by jd · · Score: 2, Interesting

      Erlang is good, and is an example of a language that is very usable in some of the niches that are under-developed. There are a few projects written in Erlang, and I would expect that to increase over time as Erlang technology improves and as more people become aware of it. It would probably help if there was more reference to it on Slashdot, LWN and Freshmeat.

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    3. Re:I'd like something else. by jd · · Score: 2, Interesting
      I will. I, for one, would be more aware of the brilliant features in Haskell programs (and Haskell in general) if information on it was a little better circulated. (A few of the records on Freshmeat had gathered so many cobwebs and so much dust that they looked like something from a 60s horror movie.) The same is true of Erlang, and many other "obscure" languages - obscure because it's below the radar of many who would be interested.

      Now, I would not call myself remotely qualified to write an article (or a book) on Haskell, Erlang, Pi-Occam, or any of the other fascinating languages out there, but I'm bothered by the rarity (and sometimes total lack) of any such text from people who are qualified. At this point, I'm tempted to write such disgracefully bad books on these subjects that the experts are compelled to write stuff worth reading out of sheer disgust. Or maybe the mere threat of me writing will be sufficient.

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    4. Re:I'd like something else. by chromatic · · Score: 2, Informative

      There's a Ruby implementation on Parrot called Cardinal. It stalled for a while until the Parrot 0.5.0 release in November, but that should have cleared the next few roadblocks.

  8. Re:Scalability? by JanneM · · Score: 5, Insightful

    Ruby is not a web development language. It is a general scripting language, like Perl or Python. You still seem to conflate the language with the specific use case of Rails - dynamic website scripting.

    I use it heavily as my general scripting language; where I would have used Perl for small utilities, file munging or what have you before, I now use Ruby. Not because Perl is bad - it isn't - but Ruby really is in many respects Perl done right, with many of the benefits and without the syntactic quirkiness. Scaling just isn't a factor for most uses of a script language.

    --
    Trust the Computer. The Computer is your friend.
  9. Re:Why Ruby? by Yath · · Score: 3, Interesting

    Ruby has some differences that are important to some people.

    * The built-in classes support functional-style programming. That is, the default action is generally to return a modified copy of the object being acted upon, so you can chain method calls together. This doesn't work well in Python, because methods frequently act like "procedures", modifying the object and returning nothing. Sometimes, Python programmers work around this by explicitly copying objects and then calling such methods. Other times, modifying the persistent object is just what they wanted; in Ruby, you would use a method which ends in "?", which is how Ruby identifies (by convention) methods that modify the object.

    Thus, to combine two dictionaries in Python, without modifying either of them:

      dcombined = d1.copy()
      dcombined.update(d2)

    In Ruby:

      dcombined = d1.merge(d2)

    Obviously the Python code is fine, but from a functional programming viewpoint, it looks awkward.

    * It's entirely predictable whether a built-in class's method will modify the object, because of the "?" suffix convention. In Python, you don't have such an explicit convention, which can sometimes make more work for the programmer.
    * Ruby doesn't rely on global functions as much, or "builtins" as they're called in Python. If you want to know the length of something, or convert a string into a list of characters, you call a method of the object rather than a global function. Some people find this to be easier, given that you only need to focus on one paradigm (object-oriented) and not two (e.g., object-oriented and imperative).
    * The print statement in Ruby prints only what you tell it to, rather than adding whitespace in various cases. Since this is the behavior of print or printf in most languages, this is nice. Ruby offers the puts method for those times you want whitespace helpfully added (like Perl 5.10's say).
    * regular expressions are more tightly integrated. Some people consider this a disadvantage of Ruby though, because you can write less explicit code.
    * Ruby gives you fewer types of quotes to learn, because ' and " are multiline.

    --
    I always mod up spelling trolls.
  10. Re:Scalability? by mindsuck · · Score: 2, Insightful

    Excuse me but http://www.ruby-lang.org/ runs on Radiant CMS, which is written in ruby, not on php.

    --
    --- I w00t, therefore I'm l33t.
  11. Re:Why Ruby? by eosp · · Score: 3, Informative

    I thought that the ? suffix meant "this makes no modifications and only returns a certain property, usually boolean" and ! meant "this modifies the "self" object. Example: foo.gsub!(/f/, 'g') would modify 'foo' directly, where foo.gsub(/f/, 'g') would return a new string but leave the old one unmodified.

  12. Re:Why Ruby? by mini+me · · Score: 2, Interesting

    The thing that makes Ruby stand out above the languages I'm well versed in (unfortunately Python isn't one of them) is its metaprogramming abilities. For lack of a better way to describe it: You don't write Ruby programs. You write Ruby programs that write Ruby programs. If Python is the same in this regard, then I guess probably nothing.

  13. Re:Scalability? by mini+me · · Score: 2, Insightful

    What inherit flaw in Ruby prevents it from scaling? Do keep in mind that performance and scalability are not the same thing.

  14. Different style of programming by Estanislao+Mart�nez · · Score: 3, Insightful

    Alright, I know this is going to be flame fodder, but I'm genuinely curious: does Ruby have anything to offer for someone who's already very proficient in Python (and Django, so Rails is already covered)?

    If you look at it from a features and libraries perspective, then you really won't find much different. But you shouldn't look at it that way.

    There's a significant programming style difference between the Python and Ruby communities. Python programmers, as a general rule, tend to be more inclined toward imperative programming, while Ruby has much more of the feel of a multi-paradigm language. To understand a lot of Ruby code out there, you need to wrap your head around concepts like functional programming, metaprogramming, and domain-specific languages. Ruby code tends favor higher-order functional combinators over primitive looping syntax (an influence from functional programming), extending the system base classes extensively (an influence from Smalltalk), and a lot of it has the flavor of trying to extend the language to look more like the problem space itself (domain-specific languages; look at something like rake, for example).

    Python aims to be "clean" in a very contentious sense of "clean." To put it in a way that will be taken very partisanly: Python is the language that you get when "clean and easy to understand" is taken to mean "only promotes the concepts that are easy to understand to a mediocre imperative programmer." For example, Guido is on the record that higher-order functions like reduce are supposedly hard to understand.

    To be fair, yeah, Python is a reasonably clean imperative/OOP dynamic language, which is no mean feat, but many of us folks really would rather have a language that supports a broader range of programming paradigms. (Though I'm not as great of a fan of Ruby as I used to be before I got going on Scheme, I must say...)

  15. where's unicode? by sentientbrendan · · Score: 2, Interesting

    I can't help but notice that there's nothing mentioned about unicode. I don't see how a major web development language, especially one made by Japanese designers, can go so long without adding comprehensive unicode support. After all, it's not like only English speaking people use rails websites...

    1. Re:where's unicode? by Riemann+hypothesis · · Score: 4, Informative

      There is support for Unicode in Ruby 1.9. An encoding is now associated to a string and you can also perform transcoding, therefore converting a given string amongst different formats (e.g. UTF-8 and ASCII).

  16. Re:Why Ruby? by Just+Some+Guy · · Score: 3, Insightful

    Ouch. Try this one:

    >>> a
    {1: 2, 'foo': 'bar'}
    >>> b
    {3: 4, 'foo': 'qux'}
    >>> dict(a.items() + b.items())
    {3: 4, 1: 2, 'foo': 'qux'}

    It scales easily (add "+ c.items()" to mix in another dict) and doesn't have any restriction's on the keys' datatypes.

    --
    Dewey, what part of this looks like authorities should be involved?
  17. Re:Why Ruby? by astrashe · · Score: 4, Interesting

    I don't know Python, and I don't want to try to compare Ruby with it. And I'm not a real programmer, just an amateur, so take this with a big grain of salt. I could be completely wrong here.

    The heart of Ruby is its use of idiom. It's a difficult thing to describe, and I don't know how you'd find some metric to measure it, or to compare it to another language. But it's very clean, and very sensible, and surprisingly simple, at least on the surface.

    There's a kind of aesthetic pleasure to be had in the syntax of Ruby. I was about to write that in that sense it's kind of an anti-perl, but that's flame bait, and I never connected with perl, and lots of people probably find perl beautiful. But Ruby is really great.

    You can do things like:

    1.upto(10) {|x| puts x }

    Which does:

    1
    2
    3 ...

    This thing looks a lot like an old fashioned for/each loop, but it's an iterator, and the code in the curly brackets is a closure. So under the hood, it's fairly different from a for/each loop.

    There are a few things to mention about this.

    First, because there are lots of iterators on the shelf, and because you can write your own iterators if you want, this thing is a lot more powerful than looping constructs in many other languages.

    Second -- and this is the sort of thing I was trying to get at above -- the syntax for closures is tweaked so it makes human intuitive sense when you're using closures with iterators. In your head, you might be thinking in for/each terms, and the syntax colludes with you if you want to hang on to that useful fiction.

    In Lisp, you can never forget about the lambdas. In Ruby, you just sort of do what you want, and the lambdas are there under the hood, but they're not jumping out at you in the same way. Ruby's syntax fits the way a lot of people think, and it hides the stuff that it makes sense to hide, and exposes the stuff that it makes sense to expose.

    And when you write out that line of code, its meaning is very clear and easy to grab a hold of, and it turns out that it's usually very concise and compact as well.

    This is a little redundant, but I want to stress it, that line of code really is a pretty thing, in a sense. It's not so remarkable if you think of it as a for/each loop, but it's not a for/each loop -- it's an iterator and a closure, and that's a somewhat complicated thing, but here it isn't complicated, or opaque. It's clean, and it makes sense, and it's concise, but most of all, the shape of the code conforms to the shape of the idea in your head. That's what Ruby is all about, and you see that over and over and over again.

    Third, this approach to idiom is a real dual edged blade for me, because there's a culture in Ruby books that sort of says, "You know what this line of code is doing, so don't worry too much about the lambdas." For a long time, I felt lost in Ruby -- like, I kind of knew what the code was going to do, but I wasn't exactly sure what was going to happen under the hood. That's a really uncomfortable place to be. I had to watch the SICP lectures to really grab hold of Ruby.

    It's always dangerous to talk about some other culture -- I could be way off base here, and I hope I don't say anything really dumb. But it feels Japanese to me -- it reminds me of a drawing where there aren't many lines, but all the lines are kind of perfect and clean. It's got that same sense of elegance to it. Let's boil this big thing down to its essence, and make it beautiful and sparse.

    I can't tell you that Ruby is better than some other language. But I can tell you that it's very beautiful, and that the beauty lives in lots of small little details. The experience of learning and using Ruby is one of noticing these little things and saying, "Wow, how great is that?"

    I used to live in an apartment building that had been designed by a famous architect -- Mies van der Rohe. The design made a difference -- I can't tell you why or how, exactly, but it d

  18. Re:Why Ruby? by siride · · Score: 2, Interesting

    It's funny because I basically use Python indenting rules for all of my programming, and everyone should anyways. I've had no problem with copy and paste (any good editor will take care of fixing the indentation for you, like Eclipse's editor), or adding in one off lines, or any of the other stuff you've complained about.

  19. Re:Why Ruby? by Yath · · Score: 2, Insightful

    Not true. Hash#clear and Hash#delete modify the object, but contain no suffix. I hate this about Ruby: you can't skim the method list for methods ending in "!". You have to also know if there exists a nondestructive version of it, and if you knew that, you'd already know its name.


    You've got me there. Ruby could stand to clean up its act and be more consistent here. It still has quite an advantage, though.

    Python: list(foo)
    Ruby: Array(foo)
    The real difference is that Rubyists will say "oh, but Array here is a method on Kernel, and methods with no explicit object get sent to Kernel". How this is different from global functions is beyond me.


    As a Rubyist, I find the important question to be "is there a method to do this". In Ruby, if something can be made into an array, you use the to_a method. In Python, you won't be using a method. Ruby's Kernel.Array is an interesting bit of syntactic sugar (granted, Ruby has a bit much of that), but it isn't particularly relevant here.

    Ruby also has << and %w (for multiple strings). While Ruby may have slightly fewer quote characters to learn, every one of them does something very different. In Python, IIRC, there's really only "single line" and "multi line".


    The question, however, is why? Why do you need to learn more syntax to enter multiline strings?

    I like Ruby, but you picked some of the weirdest (or falsest) reasons I could have imagined. How about symbols? How about blocks? How about everything being an expression? Open classes, method_missing, operators as simply syntactic sugar? Let's try to sell people on the *good* parts of Ruby. :-)


    I've focused on my pet peeves: arbitrary syntax and broken paradigms. These things require a programmer to work harder. A language shouldn't do that. I believe that the power of open classes is important too, but I can't write everything.
    --
    I always mod up spelling trolls.