From: YANAGAWA Kazuhisa Date: 2006-05-19T01:19:32+09:00 Subject: Re: Enumerable#collect and #select best practices In Message-Id: <6DC013B2-BEC1-4081-8EC4-EA2767B595C4@gmail.com> Logan Capaldo writes: > I don't think you should use #compact. What if #a_method happens to > return nil as a result? Also rescuing NoMethodError, is risky if you > have a bug inside #a_method. And if your block given to collect is fairly complex, needless work may affects scalability of code. Ie. If the number of items will be selected are small and a source array is very huge --- say, 100 : 10,000,000 --- useless 9,999,900 invocations are avoided if "select then collect" approach. -- kjana@dm4lab.to May 19, 2006 Translators, traitors.