Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming Ruby

Ruby 2.0.0 Released 121

An anonymous reader writes "Today version 2.0.0 of Ruby has been released. This is a stable release, and the Ruby team has done their best to make it compatible with 1.9, making it easier to migrate than it was to switch from 1.8 to 1.9. New core language features include: 'Keyword arguments, which give flexibility to API design; Module#prepend, which is a new way to extend a class; A literal %i, which creates an array of symbols easily; __dir__, which returns the dirname of the file currently being executed; and UTF-8 default encoding, which make many magic comments omissible.' There are also new built-in libraries for lazy stream and for an asynchronous exception handling API. The release includes a number of performance improvements and debug support for DTrace."
This discussion has been archived. No new comments can be posted.

Ruby 2.0.0 Released

Comments Filter:
  • Re:Yay! (Score:3, Informative)

    by Anonymous Coward on Sunday February 24, 2013 @12:20PM (#42995575)

    Use RVM:
    rvm get head && rvm install 2.0.0

  • by kwerle ( 39371 ) <kurt@CircleW.org> on Sunday February 24, 2013 @01:56PM (#42996043) Homepage Journal

    (sorry if this is double-posted - slashdot is choking)

    Perl is way faster. Like twice as fast. Check out my test:
    % time (echo | ruby)
    ( echo | ruby; ) 0.01s user 0.00s system 91% cpu 0.016 total
    % time (echo | perl)
    ( echo | perl; ) 0.00s user 0.00s system 84% cpu 0.007 total

    Though this is ruby 1.9.3. I don't think 2.0 is twice as fast as 1.9.3.

    But I've looked at ruby syntax a bit and it looks like it might have the advantage perl has for quick ad hoc text parsing but an overall cleaner syntax.

    What I don't care a lot about is fancy pants modules like rails. If I want to do something serious there's python.

    If you're happy shredding text with perl, I see no reason to change. If you're happy doing serious work with python, I see no reason to change.

    Ruby is a, dynamic, duck-type OO language with closures, exceptions, and a debugger.
    It has nice library infrastructure: http://rubygems.org/ [rubygems.org]
    It is generally a little less popular than Python and Perl, depending on your yardstick: http://www.langpop.com/ [langpop.com]

    There are a few implementations of ruby, including one in java (with great bridging to java classes), one for iOS (with great bridging to iOS libraries), and one based on .net (with great bindings there). So if you have a particular target platform, one of those may interest you.

    But here's the cononical answer to your question:
    http://c2.com/cgi/wiki?PythonVsRuby [c2.com]

    You might be interested in JRuby and Jython and their ability to communicate...

    I code in Ruby for a living (Rails), and I think it's a really fun language. Which is something a fair number of rubyists say, and which is something you don't hear a lot of other folks say about their language of choice. For what that's worth...

  • by Serious Callers Only ( 1022605 ) on Sunday February 24, 2013 @03:16PM (#42996525)

    Apart from the maths libraries, multithreading, UTF support (only just in - enjoy the bugs!) cross platform GUIs (TK or Fox. WTF if Fox?)
    Yep, half the speed of perl and a web toolkit more obscure than PHP.

    Ruby has maths libraries (but not as extensive as Python here IMHO), threading, has had Unicode and UTF support for years (since 1.9), and has good support for the best scripting language UI if you ask me (HTML displayed in a browser with the built in web server). I suppose if your idea of 'serious programs' is desktop apps using the platform GUI through some glue code, then you're out of luck (frankly I wouldn't use Perl OR Python for that either, just use C, C++ and/or the platform language of choice). That's a silly definition of 'serious' though.

    Re the speed and web toolkit, you clearly don't know what you're talking about there, plenty of options on Ruby, none of them obscure or difficult, and speed is pretty good nowadays, certainly good enough for almost all applications save extensive number crunching, it's really not a problem in the real world.

    Pick your tools to suit the particular thing you're building (i.e. don't pick a scripting language to build a desktop app), but why limit yourself with silly misconceptions about tech? It's only a scripting language, comparable to many others and suitable for most of the same sort of problems.

  • by Frequency Domain ( 601421 ) on Sunday February 24, 2013 @06:30PM (#42997895)

    Java also sports the "everything is an object" mentality.

    Say what?!?!?! Java explicitly distinguishes between primitives and objects! You can't send messages to primitives or literals in Java, only to objects and classes. Contrast with Ruby, where "5.times {p rand}" is a perfectly legitimate way to print five random numbers because the literal "5" is an Integer object which can respond to any message Integers implement.

  • by Serious Callers Only ( 1022605 ) on Sunday February 24, 2013 @07:25PM (#42998297)

    Perl's speed is pretty similar to Ruby, it's nowhere near the Java VM nowadays, plus Ruby is available on the JVM if that's what you prefer to use. But the parent was talking about system admin scripts and little one liners run on the command line. If you're expecting them to be 'webscale' you're talking about something else entirely. I don't know about you but my system admin scripts are not expected to scale past the few machines I work on and run by precisely one user at a time, they're not user-facing scripts and therefore performance is not critical - they could be in any language really, I don't really use one-liners but it is quite possible to do them in all those languages, even Python.

    Finally, re Twitter, if you try to reinvent a messaging server using a CRUD web app (a la twitter), you can expect all kinds of pain, even if you write it in enterprise ready Java in the first place. I imagine their problems were more down to entirely the wrong architecture, though now that they are one of the biggest sites on the internet, things like language choice will become very important for them. It's interesting though that a site like Facebook compiles PHP to C++ and then to one big binary in order to stay up and still use one of the slowest languages available - if they wished twitter could easily have done something simliar with Ruby or moved to using the ruby on the JVM, but the new people brought in to make it work were probably coming from Java backgrounds and as it need a rewrite, they thought why not, and why not indeed, it's worked out pretty well for them. They were still on Ruby 1.8.7 till the end I think, which was pretty insane given the improvements in Ruby 1.9 and points to serious problems with the older code.

"May your future be limited only by your dreams." -- Christa McAuliffe

Working...