Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Ruby 1.9.1 Released 226

Janwedekind writes "Yuki Sonoda yesterday announced the release of Ruby 1.9.1 (Ruby Inside coverage with lots of links). The VM of Ruby 1.9, formerly known as YARV, was initiated by Koichi Sasada and has been in the making for quite some time. Ruby's creator Yukihiro Matsumoto has already presented many of the upcoming features in his keynote at RubyConf 2007. Most notably, Ruby 1.9 now supports native threads and an implementation of fibers. A lot of work also went into encoding awareness of strings. The 1.9.1 version is said to be twice as fast as the stable 1.8.7. It will take some time though until the majority of existing Ruby extensions get ported to 1.9."
This discussion has been archived. No new comments can be posted.

Ruby 1.9.1 Released

Comments Filter:
  • by Foofoobar ( 318279 ) on Sunday February 01, 2009 @03:09AM (#26682587)
    That's an oversimplification of the issue. You don't simply use a new tool because it CAN do something, it is also a matter of whether it can do it BETTER that the current tool, whether you can find people who can use that tool, whether you can find information on how to use that tool with other systems and tools and whether that tools has a robust set of expansions/libraries/modules.

    To date for alot of people and companies, RUBY was hype (and this has alot to do with the community that hyped it). Now that the hype is over, people are beginning to evaluate it for what it is. RUBY can provide an easy entry level, is a powerful language but has not to date shown it's ability to scale, continues to rely HEAVILY on languages that it's community says it is much better than in order to scale (ie PHP, Perl, Python), and the benchmarks I have seen are always slanted (ie trying to test pageload times for PHP vs RUBY without installing PHP as an Apache Module).

    So the correct phrase should be... The right tool for the job (given current employment pool capable of supporting said tool and community support for said tool).
  • You do realize neither Ruby nor Rails is an acronym, right? Ok.

    The only argument for it in the past for web dev is RAILs and there are plenty of MVC frameworks for PHP now including PHPulse, Cake and Codeigniter.

    And those don't compare well [slideshare.net], even to Rails, certainly not to Merb.

    And Merb is going to be merged into Rails.

    under large loads, it buckled

    Hardware is cheap. Couldn't you throw more at the problem?

  • Re:Ruby vs Python (Score:5, Interesting)

    by try_anything ( 880404 ) on Sunday February 01, 2009 @03:42AM (#26682697)

    Ruby is meant to be more comfortable and expressive in the hands of a programmer than Python. That means more power and more elegance, but also less regularity, more features, and more emphasis on conciseness instead of readability and learnability. (Python is surprisingly readable for non-Python programmers, which I have found handy more than once.)

    Personally, I use Python at work because I'm terrible at remembering linguistic features and syntax. At work almost every neuron in my brain is devoted to C++, so for everything else I need a nice, simple, even stupidly simple language that complements C++. Plus if someone inherits my Python code and says *gasp* "But I don't know Python!" I can honestly say, "Don't worry, you have nothing to worry about. You can learn it in a couple of days."

    People tell me Ruby is more natural and expressive, and I believe them, but if Python ever lets me down I'm skipping straight to the Red Pill, aka Lisp, which I have enjoyed recreationally on occasion. (I keep some spare neurons for myself for fun. Don't tell my boss.)

  • Unicode? (Score:5, Interesting)

    by shutdown -p now ( 807394 ) on Sunday February 01, 2009 @04:20AM (#26682795) Journal

    A lot of work also went into encoding awareness of strings

    That's quite a fancy way to say "a lot of work went into making dealing with strings and encodings as messy as possible".

    So far, Ruby 1.9/2.0 is the only high-level language I know of which allows strings within the same program to be in different encodings (attaching a reference to encoding to every string). For double fun, the encodings need not be compatible with each other (not even with Unicode). This might also make Ruby the first language in which string comparison and concatenation are not well-defined for two arbitrary strings (as you get an exception if encodings are incompatible). Just wonderful - imagine writing a well-behaved library which does any sort of string processing with input parameters with these constraints...

  • Re:Ruby vs Python (Score:5, Interesting)

    by John Whitley ( 6067 ) on Sunday February 01, 2009 @04:52AM (#26682903) Homepage

    Here's my take, having used both languages in anger. First off, let me call out a number of similarities between these languages. They're both OO, dynamic, and provide reflection capabilities (useful for meta-programming). They've both been influenced by functional languages. They both have active, vibrant user communities. Both have many open-source and shipping commercial applications that leverage or are fully built on these languages. While there are notable syntactic differences, I find that there's a certain shared "feel" between Python and Ruby.

    Now I'll call out the differences I find interesting. Python's import model (akin to #include for you C folk) is stronger than Ruby's require when it comes to larger applications. By "stronger", I mean that it's more explicit and therefore provides greater assurance against unintended effects from referencing a different module/class/object than you intended. This is a two-edged sword, since Ruby's code loading approach is less verbose and affords the construction of tools like Rails' Dependencies module which automatically finds code via a convention-over-configuration model. (e.g. calling require is never needed for the main application code of a Rails application if you just follow the file vs. class naming conventions -- this is *very* handy, IMO.)

    I'm big on powerful abstractions in programming languages. On this count, I find that Ruby wins hands down. The Python community has had a muddled approach to some key areas that Ruby had early clarity on via lessons learned from Smalltalk. Specifically, Ruby blocks are a single great primitive that covers the ground of a number of separate, less powerful entities in Python. Blocks are nothing more or less than anonymous functions, aka "lambdas", but their beauty lies in their syntatic integration. Consider the Ruby iterator pattern:
    a = [3,4,5]
    a.each do |x|
    puts x
    end

    The do ... end construct is a block. a is a Ruby Array object. The conventional iterator method each calls the block once for every element in order, as you'd expect. The neat thing here is that it's easy and natural to implement your own custom version of each for your classes. By defining this one method, and including the mixin module Enumerable [ruby-doc.org] on your class, you get definitions for a bunch of other useful standard collection methods such as map, find, select/reject and so on.

    Now, Python provides for the special __iter__ method to allow user-defined classes to support iteration. But Ruby's block-based mechanism is fully general and available to the Ruby programmer. Blocks' utility goes beyond iteration, into a wide variety of other cases where anonymous functions are useful. Some motivating examples may be helpful. Another one from Ruby's standard library:
    File.open('foo.txt','w') do |f|
    f.write(some_content)
    end

    This illustrates the Ruby idiom for resource cleanup. Here we're guaranteed that the file will be closed after the block runs. The implementation of open isn't magic, it can be expressed (**simplified slightly) as:

    class File
    def File.open(name,mode)
    file = File.new(name,mode)
    if block_given?
    begin
    yield
    ensure
    file.close
    end
    else
    return file
    end
    end
    end

    And the list of uses goes on and on. Blocks are a foundation component that makes Ruby well-suited for writi

  • Re:Unicode? (Score:3, Interesting)

    by ubernostrum ( 219442 ) on Sunday February 01, 2009 @07:23AM (#26683365) Homepage

    So far, Ruby 1.9/2.0 is the only high-level language I know of which allows strings within the same program to be in different encodings

    Perhaps you need to spend time trying more languages; you'd learn not only that other languages have done this, but that many of them later rejected the idea and moved to, typically, a pure Unicode string type with a separate non-string type for working with sequences of bytes in particular encodings.

  • Re:So? (Score:4, Interesting)

    by spitzak ( 4019 ) on Sunday February 01, 2009 @12:05PM (#26684639) Homepage

    An ASCII string can be mapped to a Unicode string. For each byte in an ASCII string there is a matching Unicode symbol.

    How should string compare work? Well for simple ==, I think it should fail if the encodings are different, as they really are different. It can also fail if the two strings encode the same Unicode but in different ways (this is possible in some encodings).

    There can however be a more complex call that converts both strings to Unicode and compares them. One huge problem with most current imlementations, including Python, is absolutely brain-dead (and "politically correct") handling of invalid UTF-8, where invalid encodings throw errors, which makes use of UTF-8 actually impossible for non-trivial programs. Instead it should never throw errors. Error bytes should represent something unique in Unicode, one popular proposal is U+D8xx (which is also an "error" in UTF-16).

    A problem Python (and a lot of other programs have) is that they think "Unicode" means "some sort of encoding where each Unicode symbol takes the same space". This requires 21 bits per symbol, the only practical way to support this to use 32 bits. Almost immediatly they run into difficulty in that Windows uses UTF-16, so they punt and use UTF-16, basically abandoning their entire idea. They should instead use UTF-8 which has enormous advantages: UTF-8 errors are not lost and can be translated differently when finally used (ie for display turning them into CP1252 is better, but for a filename turning them into the above error codes is better), all other encodings (which are byte based) can be stored in the same object, and no translation is needed when you load UTF-8 data. Also UTF-16 (including invalid UTF-16) can be losslessly translated to UTF-8 and back, so there is no problem supporting Windows backends either.

  • Re:Twice as fast... (Score:3, Interesting)

    by SanityInAnarchy ( 655584 ) <ninja@slaphack.com> on Monday February 02, 2009 @12:58AM (#26690387) Journal

    Except that slideshow is comparing the performance of popular frameworks for different languages.

    I believe it also does a comparison of a raw Rack request versus a non-cake PHP page.

    I won't try to handwave away its faults.

    Neither than I -- only pointing out that most people aren't even doing benchmarks. It's just accepted that "Ruby is Slow". I'm not saying it's fast, but I am saying that when you say things like this:

    We're talking order of magnitude here, not marginal stuff that only shows up in benchmarking.

    It might be nice to have some simple examples and numbers to back that up -- besides just factorial. They'd also be great to establish this point:

    For what I do, that's OK, because the ten minutes to run the job is completely dwarfed by the development time saved by using a sane language.

    If you're comparing a ten-line Ruby script with a hundred-line Perl script, and the Perl script is ten times faster, that would pretty clearly show the advantages of each language.

With your bare hands?!?

Working...