Basic 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 significan…
Thank you for trying. What script `pidigits.rb' do you use?
Ruby 2.0.0 Released
281–290 of 303 posts
Re: Ruby 2.0.0 Released
#282There 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 Comp…
For example, say I have a class that can process stuff, and a mixin that attempts to log calls to the #process method:
class Processor
def process
puts "Very important stuff here"
end
end
module Logger
def process
puts "Entering process."
super
puts "Leaving process."
end
end
If you just ``include Logger`` in Processor it won't work: Processor#process is looked up before Logger#process. However, if you use Module#prepend, the ancestry chain will change and calls to Process#process will be decorated as expected.Re: Ruby 2.0.0 Released
#283This 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…
Re: Ruby 2.0.0 Released
#284Earlier quoted context omitted.
I prefer my white space to not mean anything because I normally can't see it. If I show white space then I see meaningful and non-meaningful white space. I find this aggravating and figure the designer of such a language is a control freak who will likely continue to aggravate me in other stupid ways. I don't need this in my life. I don't know how this disagreement between myself and the language designer seems 'supe…
ialsoagreewiththisandfindthatshowingwhitespaceisacompletelyunnecessarythingandonlygetsinthewayofhowawesomelysmartiamtobeabletoreadallthecodeiwrotewithoutanywhitespaceinit
(And HN needs something to stop this happening.)
Re: Ruby 2.0.0 Released
#285my 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!
Re: Ruby 2.0.0 Released
#286my 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!
Why 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.
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.
Re: Ruby 2.0.0 Released
#287Basic 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 significan…
Re: Ruby 2.0.0 Released
#288Earlier quoted context omitted.
You don't implement HTTP caching, except in very specific cases. You cache generated data where you need it. This is 1) Easy to add later, 2) Doesn't sacrifice the flexibility of being able to recompose that data on-demand, and 3) Doesn't require a bunch of complex front-end infrastructure to support.
Of course "you don't implement caching". I think it was clear that I was talking about designing a cache-aware application. Cf. http://www.mnot.net/cache_docs/ .
Re: Ruby 2.0.0 Released
#289Anyone 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.
Ruby is Perl as it always should have been. Python is a dynamic variant of a better Java.[1] These result in two very expressive and potent languages with many similarities and with a lot of the best ideas of modern programming languages included (pure functions, lambdas, list comprehensions, etc.) but with fundamentally different core "belief systems" and zeitgeists. Ruby is very, very much a "there's more than one…
Re: Ruby 2.0.0 Released
#290Earlier quoted context omitted.
You should note that there's a huge gap in the definition in the English language between "trolling" and "defending". Also, stop putting your words into other people's mouth. Who here is advocating Python indentation as a cure-all? Point is, you can talk about Ruby all you want, but when you diss on Python indentation, you'd better back up your opinions with facts instead of substituting your opinion as facts. The on…
What exactly are Python defending in a "Ruby 2.0.0 Released" thread? What is the there to defend here? The title is "Ruby 2.0.0 Released" not "Ruby 2.0.0 Released against Python". Why did the OP of this thread even question the relevance of Ruby as compared to "Python". And why is it that only Python people feel a need to do that in every thread on other languages? Its always the Python guys who do this, I never see…
The sole reason I'm here is to find out what's new and fun in Ruby. The reason I'm replying is because I see people spreading FUD again about Python's whitespace rules without anything to back it up.
I've seen tons of derogatory names Java, C, C++ people call Pythonistas, Rubyists and Perlists scripting kiddies and such. I've seen some pretty prominent Perl hackers (Sam Tregar and others) complaining about Python's range start at 0 and such.
Stop living in a paranoia bubble and think everyone is against you.