

Ruby 2.0.0-preview1 is out - tenderlove
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/46348

======
whalesalad
I have a confession to make. I've been a Python (django+flask) guy for years,
but I just recently jumped ship to Ruby and couldn't be happier. Within the
last 60 days I've deployed 2 production websites, rebuilt my own personal
blog, and am currently busting ass on my own project's API -- all of it in
Rails. I still like Python, but I'm a HUGE fan of Ruby now. It's so much fun
to write.

I'm excited to be a part of such an active community as well. It seems like
every week there is an exciting event, release, or new project being
announced.

Looking forward to building this locally, hopefully with these fast require
patches applied: <http://bugs.ruby-lang.org/issues/7158>

self.woohoo!

~~~
aaronblohowiak
what are the differences that make it more fun?

~~~
weaksauce
I am in the same boat as gp. rails has a lot of nice time savers, RVM is
better than virtualenv, I like that in ruby you have more than one way to do
things so you can write the way you feel most natural, ruby is more fun to
program in for me(not a huge fan of the indentation now because I have had to
reformat scripts to work correctly one too many times now). packaging in
python is what pushed me over the edge though. It never felt like I could get
anything installed nicely because the "best practice" for the packing managers
were changing daily. rubygems is much nicer in that respect. I still like
python but in the future I am going with ruby unless I have to use something
else.

~~~
tta
rbenv (<https://github.com/sstephenson/rbenv>) is better than RVM.

~~~
csarva
I used rbenv for a while but what killed it for me was the huge startup lag it
adds to every invocation of ruby or any other bin installed via a gem. I was
seeing delays of 4-5 sec which disappeared when I switched to RVM. The
universe of tools and integration is also far better in RVM land (though this
may have changed more recently).

~~~
kingfishr
I had this problem right when I started using rbenv. Eventually with some help
I realized that just starting bash was slightly slow, and that all the various
bash scripts that rbenv runs were compounding this for a 2+ second startup.

In my case, everything was fixed by moving the the things that only need to be
run in login shells out of my ~/.bashrc (where they should have been in the
first place).

See the bug I filed against rbenv at the time:

<https://github.com/sstephenson/rbenv/issues/70>

Since that time, I've been using rbenv exclusively (development and
production) and it's been great.

------
twelvechairs
The detailed 2.0.0 features list is at <https://bugs.ruby-
lang.org/projects/ruby-trunk/roadmap#2.0.0> for those interested.

I'm surprised there's not more talk here about the interesting additional
features, like Proc/Method#to_source

~~~
matthuggins
I can't think of a situation when I'd need a method like
Proc/Method#to_source, especially in everyday Ruby usage. That's probably why
it's not being talked about as much as some of the other new features.

~~~
lucisferre
I can't find any info on these method right now, but assuming they do the
obvious, it's useful for all sorts of tooling and debugging situations.
Situations you might not write the code for but almost certainly will use.

------
salimmadjd
Has anyone done any performance testing on this yet? Just curious if the new
bitmap GC is more efficient with memory and also if 2.0 is faster as it was
promised.

~~~
nivloc
Benchmarks don't mean much until it's released, if ever. But I was playing
around with it, and it's hard not to get excited about performance!

    
    
          |  mem | time |
      p1  | -24% |  -3% |
      p2  |  -8% | -12% |
      p3  | -31% | -12% |
      avg | -21% |  -9% |
    

(over 1.9.3)

Those are a couple workers I fired up for an hour. p2 relies on a C library,
which might account for the smaller drop in memory usage. CPU needs
investigation.

The numbers are kinda useless, but look good anyway.

------
eta_carinae
Is it just me or has the world moved on from Ruby? I'm seeing more companies
and projects moving away from it than adopting it. It feels like Ruby had a
nice shot at becoming a mainstream language thanks to Rails but it just ended
up blowing up like a bubble.

~~~
veemjeem
I think it just became a mainstream language. Many shops use ruby now, but
nobody really talks how they're "using" ruby because it isn't cool anymore.
Kinda like in the 2000's when everyone was talking about how they were using
Java and VCs would throw money in their face. It's rare to see a company these
days to evangelize their use of Java.

These days people prefer talking about how they're using node.js or Go.

~~~
codewright
There are secret weapons other than Node.js or Go, which don't necessarily
make you more productive like moving from Java to Ruby.

------
nnq
"Named arguments" - what took you so long?! it always annoyed me that this is
not always considered a standard language feature and added in from version
0.1 of any language, no need to hack around it by passing dicts/hashes around
...Python got this right long time ago ...it always amazes me that people
never seem to care about this

~~~
Xylakant
The standard solution (using splat and passing a hash) was close enough to
work. It's not named arguments, and it certainly has its pitfalls, but it was
close enough for most things. So nobody obviously thought it was important
enough to change before now.

There's a lot of languages that don't have named arguments so it's probably
not that much of a deal either.

~~~
nnq
...but the perceived philosophy of Ruby is along the lines of "developer joy
above anyth else" (above speed, above code readability etc.) and this is a
100% developer joy feature and it's been ignored time and time again (probably
because people are too busy building cool stuff to have time to bitch about
this but still...)

~~~
Xylakant
It is. And the feature hasn't really been ignored. The hash-syntax was amended
so that passing arguments as hashes can be made to look more like named
arguments [1]. It's still not named arguments, but about as good as you can
make it while still remaining somewhat backwards compatible. So yes, it took a
long while but no, the pain was not very great. I never really missed that.

[1]

Voice-of-Evening:~ fgilcher$ irb 1.9.3p125 :001 > def foo(args) 1.9.3p125
:002?> puts args.inspect 1.9.3p125 :003?> end => nil 1.9.3p125 :004 > foo bar:
"baz", foo: "bar" {:bar=>"baz", :foo=>"bar"} => nil 1.9.3p125 :005 >

------
holgersindbaek
Any plans on when 2.0.0 will be the standard? When will it be released to the
world and when will it be adopted by people?

~~~
cheald
It's scheduled for a Feb 2013 release, and adoption among Rails folks will
likely depend on how painful it is to upgrade to from 1.9.3.

------
Toddward
Handy-dandy one-liner to install it with rbenv (provided you have ruby-build
installed).

curl
[https://raw.github.com/gist/3998200/a09c4eb21256ad17880f7d8d...](https://raw.github.com/gist/3998200/a09c4eb21256ad17880f7d8dcc1455c5434a1815/2.0.0-preview1.sh)
| sh

~~~
juzfoo
Not sure if RVM typically supported the preview releases. It would be nice if
it did though.

~~~
charliesome

        rvm install ruby-2.0.0-preview1

~~~
xinuc
in my case, i need to do

    
    
      rvm install ruby-2.0.0-preview1 --verify-downloads 1

------
senthilnayagam
rvm get head rvm install ruby-2.0.0-preview1

installed it for me, but rubygems install failed

------
wiradikusuma
honest question. for someone who already know scala and groovy (moving from
java), what is the selling point of ruby? esp in regards to (1) its syntax (2)
its library and ecosystem and (3) its performance

~~~
rohitarondekar
(1) Syntax wise Ruby is a lot easier and more expressive than Scala. IMHO I
feel that Ruby is an OO language with some functional sprinkles while Scala is
a functional language with OO sprinkles.

(2) Ruby has a great ecosystem if you are building web apps. It's also got a
lot of testing libraries. :) But in seriousness the number of libraries in non
web/tooling space is slowly increasing as faster Ruby implementations have
become a focus point. Also JRuby allows you use the vast ecosystem of Java
from within JRuby.

(3) Performance wise I'm pretty sure Scala will outperform Ruby. I don't think
JRuby will be able to compete either. Charles Nutter, JRuby Core developer
wrote this blog post which explains why Ruby is hard to optimize ―
[http://blog.headius.com/2012/10/so-you-want-to-optimize-
ruby...](http://blog.headius.com/2012/10/so-you-want-to-optimize-ruby.html)

Of course take everything I've said with a bag of salt! :)

------
tbrock
Notable Features:

    
    
      - Named arguments
      - Multiple inheritance (traits)
      - Incremental performance improvements over 1.9's VM
      - Better compatibility with non-unix environments and small/constrained devices (embeddable)
      - Sandboxed VM's (VM per thread)

~~~
pabloh
There is no multiple inheritance in ruby 2.0, there are mixins (like traits)
tough, but they have being in ruby since I can remember.

Also, there won't be MVM (Sandboxed VMs) on this release.

~~~
draegtun
Ruby 2.0 was (and hopefully still) earmarked to have traits which are an
_enhancement_ on mixins providing a much better & refined compositional
implementation.

Thus it (should) allow you to do things like excluding or renaming
methods/traits ala Perl roles -
[https://metacpan.org/module/Moose::Manual::Roles#METHOD-
EXCL...](https://metacpan.org/module/Moose::Manual::Roles#METHOD-EXCLUSION-
AND-ALIASING)

~~~
pabloh
Refinements will be at the 2.0 release but I wouldn't call that feature
"multiple inheritance".

~~~
draegtun
Neither would I because _refinements_ are something completely different to
_traits_!

 _Refinements_ proposed in Ruby 2.0 allows you to localise _monkey-patching_
much like you can do in Perl with dynamic scoping (for e.g.:
<http://news.ycombinator.com/item?id=1603321> |
<http://news.ycombinator.com/item?id=3455507>). For further info on Ruby
refinements see here: <http://timelessrepo.com/refinements-in-ruby>

_Traits_ are an improvement to mixins. IIRC Matz gave a talk (RubyConf 2010?)
where he describes the proposed traits implementation. Here's one set of
slides (not Matz's talk) which also shows some traits examples -
[http://www.slideshare.net/fabiokung/ruby-20-to-infinity-
and-...](http://www.slideshare.net/fabiokung/ruby-20-to-infinity-and-beyond)

