Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Ruby Programming

Ruby 2.1.0 Released 65

Today marks the release of Ruby version 2.1.0. A brief list of changes since 2.0.0 has been posted, and file downloads are available. Here are some of the changes:
  • Now the default values of keyword arguments can be omitted. Those 'required keyword arguments" need giving explicitly at the call time.
  • Added suffixes for integer and float literals: 'r', 'i', and 'ri'.
  • def-expr now returns the symbol of its name instead of nil.
  • rb_profile_frames() added. Provides low-cost access to the current ruby stack for callstack profiling.
  • introduced the generational GC a.k.a RGenGC (PDF).
This discussion has been archived. No new comments can be posted.

Ruby 2.1.0 Released

Comments Filter:
  • by Anonymous Coward on Wednesday December 25, 2013 @05:26PM (#45783599)

    Are you sure you mean what you say? The last release to appreciably break compatibility was the jump from 1.8 to 1.9, when they replaced the interpreter with a JIT VM (this should have been called 2.0, IMO). That was back in 2007. Every release since then has preserved backwards compatibility.

    If you actually meant Rails, well, then I understand that. At least they're improving.

  • by Jane Q. Public ( 1010737 ) on Wednesday December 25, 2013 @07:02PM (#45784109)

    "My scripts stop working and I have to fix everything, this is not userfriendly."

    That's not a problem with Ruby, it's a problem with jruby.

    "Documation is scattered and incomplete. It's something that needs to fixed if they want to get to version 4"

    No, it isn't. [ruby-lang.org]

    And if you want more documentation get your hands on the book "Programming Ruby" (often incorrectly called "the pickaxe book"), like everybody else does. It is frequently updated for the latest ruby versions. Since it's from Pragmatic Programmers, purchase once and get the (pdf) updates whenever they come out.

  • Re:Trendy no more? (Score:5, Informative)

    by subreality ( 157447 ) on Thursday December 26, 2013 @06:02AM (#45786733)

    I've used both a fair bit. They are similar in many ways so it's mostly a matter of preference.

    I've found Ruby makes it easy to explore objects and see what can be done with them. The consistent OO model makes it easy to perform concise data manipulation. Here's a quick example:


    irb(main):001:0> arr = ["1", "2", "3", "4"]
    => ["1", "2", "3", "4"]
    irb(main):002:0> arr.methods - Object.methods
    => [:to_a, :to_ary, :[], :[]=, :at, :fetch, :first, :last, :concat, :>>, :push, :pop, :shift, :unshift, :insert, :each, :each_index, :reverse_each, :length, :size, :empty?, :find_index, :index, :rindex, :join, :reverse, :reverse!, :rotate, :rotate!, :sort, :sort!, :sort_by!, :collect, :collect!, :map, :map!, :select, :select!, :keep_if, :values_at, :delete, :delete_at, :delete_if, :reject, :reject!, :zip, :transpose, :replace, :clear, :fill, :slice, :slice!, :assoc, :rassoc, :+, :*, :-, :&, :|, :uniq, :uniq!, :compact, :compact!, :flatten, :flatten!, :count, :shuffle!, :shuffle, :sample, :cycle, :permutation, :combination, :repeated_permutation, :repeated_combination, :product, :take, :take_while, :drop, :drop_while, :bsearch, :pack, :entries, :sort_by, :grep, :find, :detect, :find_all, :flat_map, :collect_concat, :inject, :reduce, :partition, :group_by, :all?, :any?, :one?, :none?, :min, :max, :minmax, :min_by, :max_by, :minmax_by, :member?, :each_with_index, :each_entry, :each_slice, :each_cons, :each_with_object, :chunk, :slice_before, :lazy]
    irb(main):003:0> arr.pop
    => "4"
    irb(main):004:0> arr.join
    => "123"
    irb(main):005:0> arr.map { |i| i.to_i }
    => [1, 2, 3]
    irb(main):006:0> arr.map(&:to_i).reduce(&:+)
    => 6

    Here's the same thing in Python:


    In [1]: arr = ["1", "2", "3", "4"]

    In [2]: dir(arr)
    Out[2]:
    [(stuff removed, fucking lameness filter) 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']

    In [3]: arr.pop()
    Out[3]: '4'

    OK, it's pretty sim

  • Re:Trendy no more? (Score:3, Informative)

    by anchovy_chekov ( 1935296 ) on Thursday December 26, 2013 @06:16AM (#45786771)
    In respect to our Python-coding brothers and sisters, both Python and Ruby are very developer-friendly. Anyway, here is a nice comparison of the two languages' features: http://stackoverflow.com/questions/1113611/what-does-ruby-have-that-python-doesnt-and-vice-versa [stackoverflow.com]

    Obviously I prefer Ruby and to touch on the meta-programming aspect (whether good or evil), IMHO Ruby does a better job in this area. Mutable classes might give some people the heebie-jeebies, but it's saved my bacon several times. Ruby's Smalltalk-like message passing is sweet. Writing DSLs in Ruby is much more straightforward than in Python. There are many things to like.

    Python gives you a nice sense of structure, but that can be a curse as well as it feels quite rigid. Most of the people I know who code in Python come from an engineering background, and that kinda makes sense to me. It feels like an engineering language. Ruby on the other hand is more fluid. It lends itself to more organic styles of coding.

    The original AC post about "Ruby adds nothing to the existing languages" is clearly a troll, though I'd say the poster is right in a way. Ruby doesn't necessarily introduce anything new - it just puts it all together in the one place. Plus it's a joy to code in.

Those who can, do; those who can't, write. Those who can't write work for the Bell Labs Record.

Working...