Live data from Hacker News

Ruby 2.0.0 Released

ruby-lang.org

271–280 of 303 posts

Re: Ruby 2.0.0 Released

#271
post #266

Earlier quoted context omitted.

The problem is something like this. There is a cancer patient and he complains of head ache, the family members around give him a Paracetamol 500mg. The family members now also expect that Paracetamol just given will also cure him of cancer apart from curing his headache too. Python people constantly advocating white space indentation as some kind panacea to all programming problems programmers have ever faced is irr…

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 any Java, C, C++ or Perl guys do this.

This has become very common.

The way I see and this very theme, is pretty re current in every language thread.

>>I still haven't seen a valid argument against Python whitespace

I still haven't seen a valid argument on why Python people need to descend on every language thread and start this discussion. Even if the topic has nothing even remotely to do with Python.

>>or people who have the guts to say they just don't like it.

Or people who have the guts to see an opportunity on every language thread, then descend and do marketing-through-trolling.

Re: Ruby 2.0.0 Released

#272

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?

Re: Ruby 2.0.0 Released

#273
post #264

Earlier quoted context omitted.

Or, instead of having the convention that objects with a length implement __len__, you could have the convention where they just implement len and you could just call obj.len.

In java the arrays objects expose a public int attribute called .length. The strings also expose a .length attribute, but it's a method. If, for some reason, you need to know how many elements are in enum, you need to call NameOfTheEnum.values().length. If you have a Collection (a Map, a List...), you need to call .size(). ... Yeah. You are right about the fact that a possible "convention" would be to call .len, not…

I'm not sure why Python has to be backwards compatible with Java, given that Python is a totally different language released four years before Java.

Re: Ruby 2.0.0 Released

#274
post #189

Earlier quoted context omitted.

Sorry, but Hibernate has been far superior to ActiveRecord from day one. ActiveRelation is very similar to the criteria api, but it still uses string parsign. HQL is awesome. That said, I haven't done Java for 3 years and am a 100% rubyist (and some lua) The developments of rails are good. But they are simply all the stuff that maturing platforms will need. Rails is becoming JEE, but in a more developer friendly way.…

Keep in mind that I'm not an ActiveRecord fan; the internal architecture drives me nuts , but I do like that I can use SQL when I want to, without ActiveRecord getting in the way. Here's the first Google hit I came across when looking to use PostgreSQL fulltext searches under Hibernate: https://forum.hibernate.org/viewtopic.php?p=2447426 That's 50+ lines of code, plus some XML configuration, spread over four files, t…

That 50 lines is adding functionality in HQL.. How much work is it to add a fts() method to active relation + active record?

To execute custom sql, simply:

sess.createSQLQuery("SELECT ID, NAME, BIRTHDATE FROM CATS").list();

one line of code.

Re: Ruby 2.0.0 Released

#275
post #267

Earlier quoted context omitted.

This is a non-issue. Just follow PEP 8, which clearly suggests to "Use 4 spaces per indentation level." PEP 8 has been around for over a decade, so there's no excuse for not following its recommendations.

Having to follow a indentation spec just to ensure your code runs is too much rigidity to ask of a programmer.

No, not really. All projects involving more than one coder involve coding standards, and practically all languages have a single set of well-defined coding standards(Go, Python, Java, C#, among others).

Coding standards are the most time-wasting form of bicycle shedding. Choose one and stick with it. gofmt is fantastic, and so is PEP8.

Re: Ruby 2.0.0 Released

#276

Earlier quoted context omitted.

After reading that article, I'm wondering: what's the value of Ruby refinements over dynamically-scoped monkey-patching? Taking the String.camelize example from the article, you could write in Perl: sub withCamelize (&) { my ($thunk) = @_; local *{'String::camelize'} = sub { ... }; $thunk->() } sub camelize_and_join { my ($str_ary) = @_; withCamelize { join ', ', map { $_->camelize } @$str_ary } } So you can probably…

First, Ruby has no built-in way to accomplish dynamic scoping. Perl is Very Powerful. Second, refinements apply lexically. Consider a class A where refinements have been declared, and a class B where they have not. Class A code calls Class B code. Class B code will not see class A's refinements. In the case of dynamic scope, the refinements in use by class A would be visible to class B code, when called from code wit…

Yes having dynamic scoping gives Perl a very powerful programming instrument.

And the lack of dynamic scoping in Ruby can cause problems elsewhere: http://news.ycombinator.com/item?id=5072925

PS. I seem fond of dynamic scoping because I've posted lots of examples here on HN: http://www.hnsearch.com/search#request/all&q=draegtun+dy...

Re: Ruby 2.0.0 Released

#278

Earlier quoted context omitted.

After reading that article, I'm wondering: what's the value of Ruby refinements over dynamically-scoped monkey-patching? Taking the String.camelize example from the article, you could write in Perl: sub withCamelize (&) { my ($thunk) = @_; local *{'String::camelize'} = sub { ... }; $thunk->() } sub camelize_and_join { my ($str_ary) = @_; withCamelize { join ', ', map { $_->camelize } @$str_ary } } So you can probably…

Wow, that reminds me of the classloader magic Eclipse/OSGi does so that plugins that depend on different versions of the same library can work together in the same JVM.

As aardvark179 already mentioned this is different. There are modules on CPAN which will allow you to also do class/module path munging like this and it's fully baked into Perl6: http://perlcabal.org/syn/S11.html#Versioning

Re: Ruby 2.0.0 Released

#279

my 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.

Re: Ruby 2.0.0 Released

#280
post #224

Earlier quoted context omitted.

Pythons whitespace usage, for example, makes it DOA for me. I'm not touching it. If it works for you, great. It doesn't work for me. This has to be up there with people claiming they don't like Lua because array indexing starts at 1 instead of 0. Of all the weaknesses of Python, focusing on something so superficial just seems lazy. Perhaps in the future just say that you're experienced and comfortable with Ruby and h…

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
Post reply on HN