From: Rick DeNatale Date: 2009-02-03T01:44:32+09:00 Subject: Re: Conventions in ruby and the principle of least surprise --0016363108abb419380461f2455d Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Tue, Jan 27, 2009 at 4:12 PM, Ryan Davis wrote: > > On Jan 27, 2009, at 02:08 , Damjan Rems wrote: > > My convention is use {} in oneliners. In all other examples I use >> do..end. >> > > I follow (and teach) the weirich method: > > http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc > > {} for block values I care about (think map), do/end for regular block > sends (think each). > > I use {} for blocks that return values (think #map) and do/end for all > other blocks (think #each). > Yes, it's the "I care about' that matters, a subtle distinction to the weirich method, which I wrote about: http://talklikeaduck.denhaven2.com/articles/2007/10/02/ruby-blocks-do-or-brace and Jim agreed in the comments. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale --0016363108abb419380461f2455d--