From: Jim Menard Date: 2000-12-29T06:40:03+09:00 Subject: [ruby-talk:8200] Re: My first impression of Ruby. Lack of overloading? (long) I'll try to answer the easy ones. jmichel@schur.institut.math.jussieu.fr (Jean Michel) writes: > the reason why sort! does not return its result for arrays of length > 1 eludes me. sort! returs nil if the message receiver (the array) is not changed, as do many (but not all) of the "!" methods. > - I was very surprised that each_pair is not defined for arrays, only > hashes. Of course you can roll your own: Try each_with_index instead. [1, 2, 3].each_with_index { | value, index | ... } This method is defined in the Enumeration (or Enumerable) module. > - I have some problems with scopes. In particular, that one can not > define local functions. The closest I could come with is to define a > local Proc object and use .call on it. Is that the recommended way? That's certainly possible, but we tend to use blocks instead of anonymous subroutines. Jim -- Jim Menard, jimm@io.com, http://www.io.com/~jimm/ "I invented the term Object-Oriented, and I can tell you I did not have C++ in mind." -- Alan Kay