Slashdot Mirror


The State of Ruby VMs — Ruby Renaissance

igrigorik writes "In the short span of just a couple of years, the Ruby VM space has evolved to more than just a handful of choices: MRI, JRuby, IronRuby, MacRuby, Rubinius, MagLev, REE and BlueRuby. Four of these VMs will hit 1.0 status in the upcoming year and will open up entirely new possibilities for the language — Mac apps via MacRuby, Ruby in the browser via Silverlight, object persistence via Smalltalk VM, and so forth. This article takes a detailed look at the past year, the progress of each project, and where the community is heading. It's an exciting time to be a Rubyist."

20 of 89 comments (clear)

  1. Ruby Javascript by Djupblue · · Score: 2, Insightful

    It would be so nice to be able to use Ruby instead of Javascript.
    It is so much easier to write clean code in Ruby and since I use a lot of Ruby on Rails it would be great to be able to use the same code in the backend and in the browser. Go Ruby! :)

  2. Re:Ruby Javascript by korney · · Score: 2, Informative

    That's unlikely to happen. RJS with Rails is a nice alternative though.

  3. Ruby at a sight by oldhack · · Score: 2, Interesting

    I've gotten to use Python in the last couple of years - it's concise, expressive, whole lot less verbose (compared to Java, C) but bit problematic when trying for tighter design with bigger scopes.

    What are the pluses/minuses of Ruby compared to Python? Has it dumped all its Perlism now? (I looked at Ruby briefly years back).

    --
    Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
    1. Re:Ruby at a sight by Fred_A · · Score: 3, Informative

      What are the pluses/minuses of Ruby compared to Python?

      Short version : Same Same but different.

      --

      May contain traces of nut.
      Made from the freshest electrons.
    2. Re:Ruby at a sight by RAMMS+EIN · · Score: 5, Informative

      ``I've gotten to use Python in the last couple of years - it's concise, expressive, whole lot less verbose (compared to Java, C)''

      On those issues, Ruby isn't very different. In fact, I think the reason there are so many heated debates about which of Ruby and Python is better is exactly because, all things said and done, the differences don't matter that much and your preference is largely a matter of taste.

      ``but bit problematic when trying for tighter design with bigger scopes.''

      Ruby borrows features from other great languages like Lisp and Smalltalk, which allow it to more naturally express paradigms other than imperative, and classes-and-methods. On the other hand, there is something to be said for Python's "one way to do it", as well.

      Comparing Ruby and Python, I find that Python programs tend to have cleaner syntax (fewer hieroglyphs in the code) whereas Ruby programs tend to have cleaner structure (program more closely expresses what is being done because the language is multi-paradigm).

      For programming in the large, both languages have about the same advantages and disadvantages: you have metaprogramming, which is a big plus, but no static checking, which is a minus. Personally, I feel like metaprogramming is an integral part of Ruby programming, whereas, in Python, it runs contrary to the spirit of "one way to do it", but Python does support metaprogramming and plenty of people are putting it to good use.

      ``What are the pluses/minuses of Ruby compared to Python? Has it dumped all its Perlism now? (I looked at Ruby briefly years back).''

      Ruby definitely hasn't dumped its Perlisms. That's both a blessing and a curse: on the one hand, it allows for ugly programs, on the other hand, sometimes it's useful to say in a few hieroglyphs what would otherwise require lots of boilerplate code. Again, taste plays a role, but I must note that many languages that forgo Perlisms usually end up adopting regular expressions anyway, only with less power and more leaning toothpick syndrome. Given the choice, I'd rather have first-class regular expressions like Perl, even though they are the worst offenders in making Perl code look like line noise.

      Basically, if you like Python for its purity, you'll probably detest Ruby. It's messy. But if you like Python for its expressive power, you may like Ruby because it offers you more of that. If you like Python but want static typing, don't bother with Ruby, because it won't give you that. You might be better off trying OCaml, Haskell, or Common Lisp (with appropriate compiler) in that case. If you're looking for speed, those are better options, too.

      --
      Please correct me if I got my facts wrong.
    3. Re:Ruby at a sight by iluvcapra · · Score: 4, Interesting
      On Ruby's side:
      • Pervasively object-oriented, with anonymous classes, metaclasses and proper private methods. However, if your keyboard doesn't have a period, you could be convinced it pervasively functional, since it has 1st-class blocks, closures and continuations.
      • A very loose syntax, with no syntactic whitespace.
      • A lot of mindshare and goodwill, centering on the Ruby on Rails framework.

      Negatives:

      • Interpreter has been too damn slow for too long, but as you see here they're working on it.
      • it has a big learning curve for Python people. It's very different.
      --
      Don't blame me, I voted for Baltar.
    4. Re:Ruby at a sight by ultrabot · · Score: 3, Informative

      In fact, I think the reason there are so many heated debates about which of Ruby and Python is better is exactly because, all things said and done, the differences don't matter that much and your preference is largely a matter of taste.

      Indeed. It probably won't make much sense to switch from ruby to python or python to ruby, unless you get paid to do that.

      --
      Save your wrists today - switch to Dvorak
    5. Re:Ruby at a sight by Megaweapon · · Score: 3, Informative

      A lot of mindshare and goodwill, centering on the Ruby on Rails framework.

      Nothing against Rails, but there's a lot more to Ruby and the Ruby community than that one web framework.

      --
      I'm sure "SlashdotMedia" will improve on all the wonders that Dice Holdings blessed us all with
    6. Re:Ruby at a sight by robbrit · · Score: 2, Informative

      pygame comes to mind.

    7. Re:Ruby at a sight by Hurricane78 · · Score: 3, Insightful

      Personally, I feel like metaprogramming is an integral part of Ruby programming, whereas, in Python, it runs contrary to the spirit of "one way to do it", but Python does support metaprogramming and plenty of people are putting it to good use.

      You have heard of the concept of functional programming, have you? If functions are first-class citizens in data-type world, there is no separation between functions and data (or algorithms and data structures) anymore. So there is no point in a word like “metaprogramming”. What those languages support, is metaprogramming. And it’s sometimes shocking how much it exactly looks like Haskell (where everybody steals from nowadays). ^^

      JavaScript also belongs into that family.

      As soon as you understand Haskell, suddenly, all those languages become much more intuitive, expressive and useful. (I love higher-order functions! ^^)

      --
      Any sufficiently advanced intelligence is indistinguishable from stupidity.
    8. Re:Ruby at a sight by DragonWriter · · Score: 2, Informative

      Pervasively object-oriented, with anonymous classes, metaclasses and proper private methods. However, if your keyboard doesn't have a period, you could be convinced it pervasively functional, since it has 1st-class blocks, closures and continuations.

      Continuations have been removed from the core of Ruby, though they remain a library feature available with the main Ruby 1.9 implementation. They were removed for a number of reasons -- one is that no one was using them directly in production code (in part, that was a result of the fact that the pre-1.9 implementation was horrendously inefficient and produced memory leaks), and other features that they were in theory useful for (and the one thing in the standard library that leveraged them) were replaced with a more limited, tightly focussed coroutine feature (Fibers).

      With the cleaned-up continuation implementation in 1.9, if enough of the alternative interpreters do implement them as well (I think its on the plans for some, though not JRuby, the main alternative) and they get much use, I can see them working back into the language core.

    9. Re:Ruby at a sight by RAMMS+EIN · · Score: 2, Interesting

      ``You have heard of the concept of functional programming, have you? If functions are first-class citizens in data-type world, there is no separation between functions and data (or algorithms and data structures) anymore. So there is no point in a word like "metaprogramming". What those languages support, is metaprogramming.''

      Not quite. Metaprogramming is programs operating on programs. In that sense, there isn't actually a real need for a language to specifically support metaprogramming, because you can always have one program generate the source code for another program.

      The thing that metaprogramming lets you do is basically to build your own programming language. This is nothing new; in fact, the first compiler is an example of that.

      Now, languages differ in their support for metaprogramming in a single program. Some, like old versions of COBOL, don't allow any of it at all: everything you want your program to do has to be spelled out in the primitives the language provides. Most languages offer at least the ability to define ones own functions as an abstraction mechanism. It's debatable whether that counts as creating a new language, though, and most people I know would agree that it's not.

      Beyond functions, there are various mechanisms that allow more powerful abstractions. Function pointers (like C has) are one. Functions as first-class values (which you mention) are even more powerful. Indeed, using first-class functions, you can basically pass around pieces of behavior, which allows very powerful composition and abstraction. It _almost_ allows you to create your own control structures, and in many cases, the results are good enough that people don't feel the need to go any further.

      Another abstraction mechanism, and one that allows you to do metaprogramming, is macros such as those found in Common Lisp. These allow one to, basically, run a transformer function for certain patterns in the source code. The transformer function takes program code as input and produces program code as output, which is then used instead of the original code. The power of this lies mostly in the fact that you can define a macro for patterns that would occur often in your program, and let the macro write your code for you. Programs writing programs. Build your own language _inside_ the language you already have.

      Yet another construct is letting a running program change its own structure. This is something you can do in Ruby, where you can add and remove methods and variables at run time.

      Finally, there are some languages where the actual language implementation is available to and can be modified by your program. Taken to the extreme, this would allow your program to modify everything from how it is read to how it is translated to code to be executed.

      Long story short: metaprogramming goes far beyond what functions as first-class values gives you. Does that mean that the things you can do with first-class functions aren't metaprogramming? That's a matter of definition, but I would say that "What those languages support, is metaprogramming" and "there is no point in a word like "metaprogramming"" is a bit of a mischaracterization.

      --
      Please correct me if I got my facts wrong.
  4. Good News by RAMMS+EIN · · Score: 4, Insightful

    I'm glad to see so much work is being done on Ruby, and especially that people are working on compiling Ruby to native code. Ruby is a great language, but there is no denying that the old implementation (MRI 1.8 and before) is dog slow.

    --
    Please correct me if I got my facts wrong.
  5. Re:Ruby Javascript by caseih · · Score: 4, Interesting

    Truly spoken like someone who doesn't know appear to know anything about Javascript, and has never programmed anything significant in it. Or Ruby either for that matter. If you do, you should have backed up your comments with real evidence and experience rather than just a few silly expletives.

    How does Ruby retain Perl's syntax but not the semantics? Sounds like you're making this up. Have you ever coded anything significant in Ruby? I don't care for Ruby's syntax either (the ability to call functions with () means you can pass functions around as parameters), but that doesn't make Ruby any less powerful as a full OOP, dynamic language.

    As for Javascript, try using it for something significant sometime. Write a firefox plugin or something. Javascript is here to stay and is the mainstay of client-end user interface code. Javascript is an extremely powerful and dynamic language, akin to smalltalk in it's power and flexibility. Javascript uses a prototype-based style of OOP that takes some getting used to but is very powerful indeed. Even better Javascript has functional and lisp-like qualities to it. Javascript has its warts. Some of them are apparent if you've ever used Gnome Seed with GTK binding, from what I've read.

    Despite all this I'd rather use python in the browser to script DOM objects, but ahh well. I'm also bitter that epiphany dropped Python in favor of Javascript for writing Epiphany plugins. Sigh.

  6. Benchmarks or it didn't happen. by SanityInAnarchy · · Score: 3, Insightful

    I've worked with Ruby for over a year and a half, and I can say with absolute confidence that the language is horrible. You can flame back to this all you want...

    That might be an interesting discussion, actually, but:

    ...the fact remains that it's a slow blob and throwing more hardware at it is a stupid argument.

    See, that's a property of the implementation, not the language. You have noticed what's happened to Javascript lately, right? It used to be slower than Ruby. With v8, it's faster than Python.

    Also, you fail to address why throwing hardware at it is a stupid argument, and you don't provide any benchmarks that it's slow.

    No major VM is going to make it rival the top languages in raw processing power (C/C++/Java even Python).

    If you actually looked at benchmarks, you'd notice that if nothing else, Rails beats PHP, consistently, for performance.

    And Rails "automagic" combined with Ruby's inability to report exceptions in a meaninful way (the backtrace is 99% rubbish, and often reports the error in a place where it didn't even occur)

    It would help if you actually gave an example here, but you don't. In my experience, the backtrace is actually quite helpful, but use of unit tests and specs helps avoid it.

    As for Ruby in a browser - there's already projects that do that, and do it fairly well.

    Which is one of the things TFA is about. So what's your point?

    Some of them use Applets, which is where suddenly everyone has a hissie fit. Yeah, using a proprietary Windows-centric tech like Silverlight is a MUUUUCH better option.

    I suspect Silverlight is at least faster to load, but I haven't tried doing either. Javascript does what I want it to do well enough.

    Or writing a VM in JavaScript? Talk about MOLASSES!

    Again, benchmarks or it didn't happen. Make sure to test it in one of the better Javascript engines, like v8.

    If I want to use a quick scripting language with ample flexibility and power, I'll use Groovy, thank you very much. For one thing, Groovy and Grails gives me a LOT more choice as flexibility over RoR any day of the week.

    Can you give an example of how? I mean, for one, there only really seems to be Grails, whereas Ruby has more web frameworks than VMs, and that's saying something. Take Sinatra, for example:

    get '/' do
      'Hello, world!'
    end

    That's right, a REST DSL. What has Groovy got, again?

    So, Rubyists, have your little childish flames now.

    That's the most literal example of flamebait I've ever seen. Unfortunately, it doesn't look like anyone's really flaming you back. I'm the closest, and I'm just asking for facts.

    And don't assume I'm a "n00b" - I've got over 15 years IT experience in more languages that I can list in this comment block.

    With all that experience, you couldn't figure out that the comment block seems to allow very, very long comments -- almost certainly longer than the total list of programming languages that exist?

    More importantly, you seem to have fallen into the same trap that Jerry Taylor did. I have no idea what your experience is, but it certainly doesn't seem to be reflected here.

    --
    Don't thank God, thank a doctor!
  7. Re:Ruby Javascript by mythz · · Score: 2, Interesting

    Sounds like the start of a Ruby fanboi crowd right here on /.

    Javascript is a powerful functional protyped-based language that is just as powerful as any other dynamic language. Libraries like jQuery show just how powerful and expressive the language can be while applications like google maps, gmail, etc show how capable the language is.

    It gets most of its negative sentiment from devs who don't understand it fully to appreciate its strengths. I would suggest using the resources on http://www.crockford.com/javascript/ to learn some advanced techniques.

    For anyone who's interested I have a Class.js as described on my blog http://www.servicestack.net/mythz_blog/?p=3 that simplifies using OOP in Javascript.

  8. Re:Ruby Javascript by piquadratCH · · Score: 2, Insightful

    I'm sure something similar is feasible for Ruby too.

    It certainly is.

    And there's also a Python port of GWT, very aptly named pyjamas.

  9. Re:Ruby Javascript by Serious+Callers+Only · · Score: 4, Interesting

    Faggot, I've had the misfortune of using both JavaScript and Ruby (for web development and scripting) more than you likely ever have, and ever will.

    Or perhaps you're just some internet blowhard who likes to play to the peanut gallery? As you demonstrate very little in the way of knowledge in your posts, we'll never know. Your silly pronouncements of superiority in spite of very little knowledge of your interlocutor certainly make this a distinct possibility.

    Have you looked at the syntax of Perl and Ruby? The vast similarities should be pretty clear to everyone but the stupidest of mental retards...then fuck off. You'll need to use both Ruby and Perl to experience Ruby's weak semantics compared to Perl.

    You claimed that Ruby kept most of the syntax of Perl, but not the 'semantics' whatever that means in this context. Care to explain what you think it means, because you haven't so far?

    I've used both, and there are similarities, but there are also many significant differences. The object system in Ruby is far less a tacked on afterthought, you don't have to declare variables with a prefix so there is less line noise, everything is an object, nicer blocks, etc. There is also quite a tradition of choosing the way which seems least surprising and sticking to it, as opposed to 'There is more than one way to do it' in Perl - that means radically different library classes.

    The syntax of Ruby encourages legibility but keeps most of the shortcuts (in regexp for example) of Perl, while avoiding the horrific write-once possibilities of Perl which you seem to be so proud of (i.e. stuff can be done in fraction of a line of code); just because it can be done in half a line doesn't mean it should.

    There is a spectrum from code which is far too verbose to code which is far too succinct (i.e. unintelligible even to the creator after a certain period), and I'd say Perl can be pushed too far to the succinct side, but that's personal preference really. It's quite possible to write good Perl code, but that doesn't make it the be all and end all of scripting languages, indeed several other languages are now more suitable for scripting if you prefer an object-oriented approach.

    While I must agree with the sentiment that people who cheerlead for a certain language as radically different from all others need an education in the history and diversity of computer languages, to claim that Ruby is a bad copy of Perl without qualifying the statement betrays your lack of knowledge of the language, nothing more.

  10. Dynamic languages renaissance by Anonymous Coward · · Score: 3, Informative

    This is an exciting time not only for Ruby, but for other dynamic languages as well, especially javascript and python.
    For example python has a number of different implementations on the works that are starting to show good results in performance improvements.
    Pypy (python in python) is already able to generate very fast numerical code, its JIT is making progress at good pace since the last months, and a new release is expected for the end of January.
    Unladen Swallow is a Google sponsored project which aims to speed up the current cpython implementation, by implementing a jit with llvm, amongst other modifications. Their goal is to speed up current applications used by google in a relatively short time (they don't want to mantain a python implementation forever, this is an incremental improvement of cpython), and they concentrate in web applications that use c extensions.
    Psyco, which is an extension module which speeds up python by a large margin and has been around for some years, has been revamped to version 2 and shows significant improvements as well.
    We can also mention Ironpython, the implementation of python in .NET which opened the door to IronRuby.
    And there are many other minor efforts and one-guy projects that may give us surprises in the near future. For example CrossTwine linker (for python and ruby), Hotpython ( a new virtual machine built from the ground up to be fast), etc, etc...

    As for javascript, those who thought it would be a dead language by now were plainly wrong. Google's V8 is a success and runs code at holy crap speed. Safari's Nitro followed suite.

  11. Re:no cardinal? by chromatic · · Score: 2, Informative

    Let's translate that....

    The dominant meaning of "translate" used by native English speakers generally implies some non-zero amount of veracity.

    Cardinal hasn't had much activity in the last couple of months because there have been only a couple of people working on it lately, and one of them started a new job at the end of September.

    Even so, it exists, it passes tests, and it can interoperate in the same Parrot process with Perl 6 and Perl 5 code. (I suspect it can work with other Parrot-hosted languages as well, but I haven't tried.)