Tuesday, October 17, 2006

What I dislike about Ruby... (part I finished)

Mmmmkay. For you, impatient - mystery resolved.

The line #12 has been an offending one:

self.children.inject do |sum, child|


In fact it should look the following:

self.children.inject(0) do |sum, child|


Do you see the difference? Again, as in the very first example a problem with this little frisky '0'.

Could you easily deduce that from the following error message:

c:/ruby/lib/ruby/1.8/pathname.rb:189:
in `dup': can't dup Fixnum (TypeError)


Here's the point. If you are new to Ruby, you just don't know what's happening.

To summarize. I am not saying I do not like Ruby as a language. I like it quite a lot, it is nice and brings many good ideas, as mixins for example. But let us all face the fact that each technology has its bright face and a Mr. Hyde one.

0 Comments:

Post a Comment

<< Home