16 ms·
Ruby 2.0.0 Released
- phasevar 14y agoMy favorite new feature. Keywords arguments. As a Python convert, I really missed those.
- aviraldg 14y agoJust curious: what made you switch?
- bau5 14y agoruby pls
- zopticity 14y agoRuby rocks my socks.
- jacquesc 14y agoThis is pretty exciting. Might be too early to tell, but it feels like the Ruby versioning recently has been done very right. The switch from 1.8.x to 1.9.x was slightly painful, but I think 80% of Rubyists have made the jump. I'm hopeful and expecting the switch to 2.0 by 80% of Rubyists in 2013. Compared to the adoption of major version releases by Python/Java/C#/PHP, I think that's something the Ruby core release team can be proud of.
- aaronblohowiak 14y ago1.9 was not supposed to be a wide release, and it contained more breaking changes than 2.0, IIRC.
- jacquesc 14y agoI'm not 100% sure on the history, but I believe 1.9.x started as a dev release and then they changed their minds and decided it was a wide release. That initial confusion might be why the community took the time to go from 1.8 to 1.9. I think they've learned from that, as 2.0 looks like a much cleaner/easier transition.
- stormbrew 14y agoOn the other hand, it means we've now had point and minor releases that broke everything (1.9, 1.8.7, and I think even one or two of the 1.8.7 patch releases actually backported breaking 1.9 features), while the major release is apparently one where nothing from the prior release should break. I'm not convinced that means they've 'learned their lesson' so much as that they still don't know how to version things. We'll see how 2.1 goes, I guess.
- Kerrick 14y agoIndeed. I hope that ruby itself starts following the semantic versioning [0] that is so popular with ruby developers. Now that they have a "clean slate" with a 2.0.0 release, they could! [0] http://semver.org/ http://semver.org/
- steveklabnik 14y agoRails 4 will ship with "1.9.3 required, 2.0.0 recommended," so I'm expecting that to drive a lot of adoption.
- mattmanser 14y agoNot sure what C#'s doing in that list. Think you have some outdated ideas about that community, there's not been a significant breaking change forever.
- charlieok 14y ago2.0 on the 20th. Happy 20th!
- oleganza 14y agoI guess, Rubinius is no longer relevant? I remember it was a very promising project back in 2008.
- jxf 14y agoEvan Phoenix (the creator) left in 2012 to work for LivingSocial. EngineYard, his former employer, had been funding work on it last I heard, but there haven't been any releases since 2011. http://blog.fallingsnow.net/2012/03/28/a-new-door-opens/ http://blog.fallingsnow.net/2012/03/28/a-new-door-opens/
- regularfry 14y agoOnly in the same sense that there haven't been any Arch releases... EDIT: Just checked. If you `rvm install rbx`, you get code written today.
- steveklabnik 14y ago> there haven't been any releases since 2011. Every commit is a release of rbx. Yay continuous integration! That said, there hasn't been a numbered release in a while, through there will be a 2.0.
- jxf 14y agoYes, sorry for not being clearer. I'm basing the "there hasn't been a release since 2011" comment off of the Rubinius homepage, where the last numbered release is 1.2.4. The Rubinius 2.0 preview release came out in June 2011: http://rubini.us/2011/06/07/inside-rubinius-20-preview/ http://rubini.us/2011/06/07/inside-rubinius-20-preview/
- regularfry 14y agohttps://github.com/rubinius/rubinius https://github.com/rubinius/rubinius It's very relevant, and very active.
- mixonic 14y agoI really wish Rubinius has become Ruby 2.0. Making Ruby more Ruby and less C opens lots of doors.
- AlexanderDhoore 14y agoAnyone have any thoughts on why python and ruby are so similar, yet so far apart? They are obviously very close, because people switch between them all the time. And they are compared on everything (languages features, libraries, tooling...). I think it's a healthy competitive environment.
- Goranek 14y agoI'm a huge Python fan and there is nothing in the world that would force me to switch to Ruby =P
- AlexanderDhoore 14y agoThat's exactly what I mean. People feel very strongly for one or the other. Yet, even you, can't deny that they are very similar! Compare them to Java, Lisp, C, Go, Haskell, Perl,...
- __david__ 14y agoActually, I'd lump Perl in with Python, Ruby, and Javascript. They're all at about the same "power level" and have more or less the same built-in types and language features. They all have their own personality but if you only know 1 of the 4 you're still perfectly capable of writing any program that will be more or less equivalent to someone writing the same thing in one of the other 3.
- erikpukinskis 14y agoThis thread is full of people saying "I use (python|ruby) and (ruby|python) seems fine. There's just no reason to learn it" and you respond excitedly to this comment as if it's representative. http://en.wikipedia.org/wiki/Confirmation_bias http://en.wikipedia.org/wiki/Confirmation_bias
- deleted 14y ago[deleted]
- 14y ago
- tferris 14y agoToday, I'll lose at least 50 karma points, but it's worth: Why people still use Ruby? 1. Because they get dream day rates for maintaining rusty slow legacy systems 2. Because they do not want to learn new languages and can stay in their comfort zone 3. Because they think it's still 2005 and nobody cares about slow server response times And now Ruby lovers, click on downvote or give your reasons why you still use Ruby.
- deleted 14y ago[deleted]
- tomstuart 14y agoIt's fun, it's clean, it's simple, and it works.
- yakiv 14y agoI use Ruby some, but I'm not sure I'd describe it as clean exactly. I've used Python a bit recently and was struck by just how clean it seemed. (I'm not sure Python has anything that quite replaces blocks, though. I don't claim Python's all better than Ruby.)
- tomstuart 14y agoCleanliness is subjective, but: * Everything is an object, without exception. * The object model is pleasingly orthogonal and its behaviour is easy to understand and predict once you know how it works. * The syntax is high on alphanumerics and low on punctuation. * Most of the core library method names strike a good balance between brevity and clarity. * `Enumerable` is simple and powerful.
- simonw 14y agoAmusingly, you could be talking about Ruby or Python on all of these points (if you swap swap "Enumerable" for "the iterator protocol").
- thetron 14y agoCongrats Ruby team - really well done. 20 great years.
- ashokvarma2 14y agoIs ruby 2.x faster than 1.9.x. Any benchmarking data?
- haven 14y agoYes, there are performance increases. Sasada-san gave a good talk at RubyConf this year on 2.0.0's internals and performance enhancements: http://www.confreaks.com/videos/1272-rubyconf2012-implementation-details-of-ruby-2-0-vm http://www.confreaks.com/videos/1272-rubyconf2012-implementa...
- deleted 14y ago[deleted]
- donw 14y agoOverall, a good feature set. I only see some utility for keyword arguments, admittedly, but I tend to write very functional code, so maybe other people will get more mileage. Refinements, as I understand them, are a bad idea. I understand the motivation, but this is not the way to go about it. There's now a new scope all over the place (the set of refinements applied to any given class). This means that the behavior of any given class now can depend heavily on context. This makes optimization a bitch, for the same reason that it makes programming a bitch. I can now have two Strings, one Refined by ActiveRecord, the other Refined by Sequel, which expose a different set of incompatible methods.
- jacquesc 14y agoTotally agree about refinements. Hopefully the community pushes back enough on that experiment so it gets deprecated and removed. A better design approach to achieve this effect is wrapper objects (similar to jQuery and Underscore.js) where I can add functionality to existing objects. Ruby has everything we need for this already, and makes it quite easy to do.
- nnq 14y agoAren't refinements a "fixer feature", i.e. something 99% of developers should just ignore it until they really get into a problem with badly done monkeypatching, then use it to solve the problem and just move on? Why do people get so excited about them, both in a good and in a bad way? Just use them inside your library code and make sure people using your lib/framework can just pretend they don't exist, keep monkeypatching "chained inside" as your dirty little secret:P)
- tomstuart 14y agoCharles Nutter does a good job of explaining why you can't just ignore refinements: http://blog.headius.com/2012/11/refining-ruby.html http://blog.headius.com/2012/11/refining-ruby.html In summary, they makes the Ruby language harder to implement, and Ruby code harder to understand. You can't pretend they don't exist if their existence compromises the meaning of your code and the performance of your chosen Ruby implementation.
- kybernetyk 14y agoI've been waiting for native keyword arguments for years. A great addition that should make code more maintainable.
- noelwelsh 14y agoI do wonder about the long term success of Ruby. Rails is easily the most visible project for Ruby. Rails is big, and all that code represents a high barrier to entry for any framework in a different language that wants to compete. However, a lot of people I talk to are moving to pure JS front-end + REST backend. In this world Rails doesn't deliver any particular value (in my opinion). Ruby also has utility for doing lots of scripting type tasks (things like Jekyll). The libraries you need to do this are simple to write. Python is perfectly adequate for this task already, as is Node (modulo callback spaghetti). So there is no barrier to entry here. In summary I don't see any project going forward that provides enough value to maintain interest in Ruby. Thoughts? [NB: I'm not saying Ruby is going to die overnight. I just think it will slowly become less relevant.]
- rb2k_ 14y ago> Thoughts? I think most of the things you say sound like you haven't worked with either. Few people are moving to pure JS front-end. Some are, some write blogposts about it, but the majority of people isn't. Some are even moving back, a year or so ago there were a lot of blogposts about that kind of stuff. Rails offers a lot of interesting things in the M and C parts of the MVC pattern (Object persistence, REST endpoints, ...). People even write books about the topic ( https://learn.thoughtbot.com/products/1-backbone-js-on-rails https://learn.thoughtbot.com/products/1-backbone-js-on-rails ) Ruby and Python are pretty similar and as with Java and C++, there is space for both. I personally like Ruby more, but I guess that's just a matter of style.
- noelwelsh 14y agoFWIW, I only used examples with which I have personal experience. All new front-end projects we're doing are pure JS. I've used Jekyll in various commercial and non-commercial applications.
- rschmitty 14y agohttp://engineering.twitter.com/2012/05/improving-performance-on-twittercom.html http://engineering.twitter.com/2012/05/improving-performance...
- mikaelf 14y agoWe need tutorials. Videocasts! Please.
- marvwhere 14y agomy personal best new feature is: "The UTF-8 default encoding, which make many magic comments omissible" because i'm from Germany and we had to add: # coding: utf-8 in every freaking controller to get our german stupid letters (öäüß) to run without problems. so i'm looking forward to my next project where i can use 2.0 from the scratch. thank u!
- rebyn 14y agoAgree. Everytime I do locales in Vietnamese I have to do the "magic encoding". Not anymore. Fsh.
- kawsper 14y agoWhy are you writing special characters in your controllers? We are Danish, and are writing comments in English, and all locale strings is placed in i18n-files.
- BITCOINATOR 14y agobecause we are in 2013. special characters should finally be fixed in any computer language, as the internetz has shown us that the world is so big. unfortunatley, in reality we still have to cope with many primitive char problems - a mindset like demonstrated by your comment is one source of these unbelievable stone-age problems we still have to face and programmers with this limited view should leave the modern computer industry. in 20 years everybody will have to program in cantonese, if chinese programmers would have such a limited view of the world.
- yxhuvud 14y agoAnyone know if it is made default for regexps as well, or will we still have to do add /u to every regexp?
- JulianMorrison 14y agoI wonder, is asynchronous exception handling going to make exceptions useful in evented/fibered code? Because right now, the ability of your stack frame to unpredictable blow up is a complete nuisance.
- JulianMorrison 14y agoDoes anyone here have a link to the new rubydocs for this?
- ksec 14y agoStill waiting for Ruby 2.0 Benchmarks
- grey-area 14y agoThere are some nice features here: Keyword arguments, which give flexibility to API design This looks good to replace all those options hashes in rails for example, though I wish they'd made it an all or nothing thing, apparently you can still do this: def foo(x, str: "foo", num: 424242) i.e. use some named and some unnamed in the same method which looks ugly. Module#prepend, which is a new way to extend a class Compared to something like Go, I do worry the Ruby inheritance picture is becoming overly complex, but I guess there must have been some use case for this - anyone know where it is going to be used? __dir__, which returns the dirname of the file currently being executed This is a great little enhancement which means I can replace File.dirname(__FILE__) from the start of a lot of utility scripts. Would love to have seen more little improvements like this. The UTF-8 default encoding, which make many magic comments omissible At last! This should have been in 1.9. Performance improvements While these are incremental, it's nice to see more improvements - thanks Ruby team! Onigmo, which is a new regexp engine (a fork of Oniguruma) Not sure what this changes from Oniguruma. Refinements Refinements seems to be the headline feature for a lot of people, but I have two hesitations about it: it's encouraging a practice which has come to be seen as one of the most dangerous parts of Ruby - monkey patching, and the process of deciding its inclusion seems to have brought about a few schisms with the community developing alternative Ruby implementations because of performance implications, and raised wider issues about the Ruby design process: http://www.confreaks.com/videos/1278-rubyconf2012-toward-a-design-for-ruby http://www.confreaks.com/videos/1278-rubyconf2012-toward-a-d... There is the argument of course that it's attempting to limit monkey patching and therefore limit the damage caused, but should it be encouraged at all? It'd be interesting to hear more on what happened here from anyone has been following this closely.
- vidarh 14y agoModule#prepend doesn't look too bad from me from a complexity perspective - inheritance in Ruby boils down to two parallel trees: One of the inheritance chains, and one of the method lookups. Really we're dealing with a single tree of "actual" inheritance, with some of them being "hidden" in some contexts. It gets a bit complex if you want to do meta-programming or do something that depends on the inheritance hierarchy, but mostly it behaves the way people expect in regular use. Refinements, on the other hand, looks brain-damaged to me. I see the rationale, but the outcome looks more complicated and error-prone than the situation it is trying to address... And it looks like the type of thing that will "infect" other code, just like C++ code for a while got infections of throw specifications on member functions, that then got propagated all over the place and cause major pain every time you tried to modify code. Until most people stopped using them much again except in very limited circumstances.
- deleted 14y ago[deleted]
- eduran 14y agoi thought ruby was dead over javascript
- hcr 14y agoCongrats! Great works
- eduran 14y agoi thought ruby was dead over javascript
- moron4hire 14y agoCongrats, Ruby Team. Always good to see a new release. Onward and forward.
- jdelsman 14y agoJust submitted a pull request to Homebrew to have this added. Can't wait :-)
- whalesalad 14y agoI'd definitely look at rbenv. Combined with it's plugin ruby-install, you've got a pretty simple and powerful alternative to rvm. I use it exclusively.
- zaius 14y agorbenv is definitely better than rvm, but if you use the same ruby version between all your projects, a single version of ruby installed through homebrew is a much better way to go.
- copx 14y agoI like Ruby but keywords arguments are the solution to a problem which shouldn't exist in the first place. Namely functions like.. myFunction(something, 23,23,100, somethingElse, true) People should write smaller, more specialized functions instead (less arguments). That makes software both: more efficient and more maintainable. If you start thinking: "Damn I wish I had keyword arguments to make this function call more comprehensible!" .. the problem is elsewhere.
- TylerE 14y ago100% disagree. For some use cases they are very useful. Like, imagine a function that generates an HTML snippet, and can optionally assign some specific class names/ids to some of the elements.
- MBCook 14y agoAs much as many people seem to hate the way Objective-C does things, I really like how it intersperses the arguments in the function name. It makes it so easy to identify parameters. Most languages: someObject.throwProduce(apple, myEnemy, 14, 17); Objective-C: [someObject throwProduce:apple at:myEnemy withForceInN:14.0 maxDisanceInM:17.0]; As long as you name the function appropriately, it's clear what each parameter does without having to look up the name. Many people complain about the long names (in this case throwProduce:at:withForceInN:maxDistanceInM:thenWaitInMS:), but it avoids the situation you have in other languages where there are 4 functions with the same name but different signatures. In Obj-C the naming conventions discourage such ambiguity and encourage self-documenting names.
- jayferd 14y agoAnd this day shall be know as Ruby Two's day.
- jayferd 14y agoI've been waiting for that for a long time ._.
- schiang 14y agoNice. Time to use to_hash.
- pkmiec 14y agoI totally agree about refinements being a terrible idea. Brian Ford (of Rubinous) makes an excellent argument: http://www.youtube.com/watch?v=BagNfTbXn3w http://www.youtube.com/watch?v=BagNfTbXn3w. What is the best way to let Ruby team know that refinements are a bad idea?
- steveklabnik 14y ago> What is the best way to let Ruby team know that refinements are a bad idea? Get involved in the discussions on ruby-core.
- ScotterC 14y agoBasic Ruby 2.0 benchmarks calculating pi from gist [1] $ ruby --version ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-darwin12.2.1] $ time ruby pidigits.rb 10000 2>&1 > /dev/null 17.51s user 0.11s system 99% cpu 17.639 total $ ruby --version ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1] $ time ruby pidigits.rb 10000 2>&1 > /dev/null 4.64s user 0.27s system 99% cpu 4.927 total That's a significant difference in speed. Going from 17.51 seconds to 4.64 seconds 1. https://gist.github.com/thoughtpolice/5025417 https://gist.github.com/thoughtpolice/5025417
- mrgordon 14y agoIf we see these sorts of improvements overall, then this is a very exciting update
- mixonic 14y agoI've also seen a speedup in Rails app boot time (the require optimizations): 1.9.3-p194: 11.8s 1.9.3-p385: 9.9s 2.0.0-rc2: 6.1s! Tests were done with `time bundle exec rake environment` 5 times, dropping the highest and lowest and getting the mean of the rest (lazy snow day benchmarking). Very exciting!
- ko1 14y agoThank you for trying. What script `pidigits.rb' do you use?
- draegtun 14y agoMost likely it was this script: http://benchmarksgame.alioth.debian.org/u32/program.php?test=pidigits&lang=yarv&id=3 http://benchmarksgame.alioth.debian.org/u32/program.php?test...
- randomsearch 14y agoSerious question - should I learn Ruby? I spent a little time looking at Ruby in the past. It seems like a nicely designed, clean language. However, it seems to me that it lost to Python in many domains. In addition, I've heard stories about Ruby having performance problems. For example, I heard Twitter rewrote their backend in Java/Scala because Ruby didn't perform well enough. Recently I was at a Cloud Computing symposium thing attended by academics and industrial developers. No-one in the room was using Ruby for development anymore. Has it died? Is there any point learning it?
- ikailan 14y agoLearn what you want to learn, because your tools will change. Many Ruby programmers came to Ruby because of Rails. I'm part of the camp that stuck around because of JRuby for a while, but nowadays I find that I write very little Ruby and a lot more Python. Don't worry too much about what you hear about performance. If you are building a Twitter, then yes, it might matter what language you're learning. Ruby, Python, and PHP tend to be in the same ballpark in terms of performance, with each having their own warts. As of late, I've been most interested in golang.org. You can learn the basics in an afternoon at tour.golang.org.
- randomsearch 14y agoCool, thanks. Actually, Go was an alternative I was considering for my next language. More worthy than Ruby? Is it a possible Python replacement?
- fersho311 14y agoI was stuck on this for a few hours, so hopefully this might help someone. If you are install ruby 2.0.0 with rvm, make sure you do rvm get head before doing rvm install 2.0.0 or rvm reinstall 2.0.0