From: Denys Usynin Date: 2002-09-07T06:40:32+09:00 Subject: Re: Larry Wall's comments on Ruby > But you've piqued my curiosity: tell me, what did you find > surprising about Ruby? Where "surprising" is defined as > "you thought it worked one way" and then discovered that it did not, > or that it worked that way some of the time and some other way > the rest of the time? well things that surprised me will probably be considered obvious by you. as I said its only a matter of the background and maybe of the thinking style. But here are just a few examples I had to struggle with: 1. && and || are not the same as "and" and "or". The difference is subtle, but why weren't these made completely synonymous in the first place? 2. File.open( "myfile" ) { |file| puts "block..." } will automatically close it. I keep trying to close it in the end of block. I may see how it seems very intuitive to some people but I am used to C. 3. myString.each { } processes lines not bytes. Why? 4. myBlock = Proc.new { puts "myBlock..." } then I intuitively expect to be able to do this: 5.times myBlock but it won't work 5. Forgiving syntax leaves lots of room to fool yourself. Classical example: x = y +z It is VERY counter-intuitive to me that this tries to call method y with paramter +z instead of adding the two numbers together I could go on. Anyway, my point is, as with every language you can't just blindly rely on your intuition in Ruby, you have to remember how to do some(many?) things. And just as with every other language, once you have a feel for it, you can do a lot of things just by pure intuition. Ruby may have less things to remember than C++ but it doesn't change the big picture.