From: dblack@... Date: 2007-06-13T04:26:48+09:00 Subject: Re: a matter of style Hi -- On Wed, 13 Jun 2007, Robert Dober wrote: >> Almost. puts adds "\n" unless it's already there. So these are >> equivalent: >> >> print "hello\n" >> puts "hello\n" > Right but do you remember when I stupidly changed your code from > puts a > to > puts a.join("\n") > > So this is another difference between print and puts, puts prints the > content of an array seperated by newlines. print does no such thing of > course. > >> particular, please have mercy and don't leave the parens out in method >> signatures. Things like this: >> >> def a b, c, d = 1 >> >> read very strangely, at least to my eyes. > I love it, I *really* read it better like this. But I guess the > community rather puts parens :( and if you want to comply listen to > David. > Let us just have a look at the Ruby core as David suggests below Another little test: $ ruby -e 'puts ARGF.select{|f| f =~ /^\s*def\s\w+\s+\w+/}.size' $(ruby -e 'puts Dir["**/*.rb"]') 120 $ ruby -e 'puts ARGF.select{|f| f =~ /^\s*def\s\w+\s+\w+/}.size' $(ruby -e 'puts Dir["**/*.rb"].reject {|fn| fn =~ /rexml/} ') 9 :-) I think Sean is skewing the graph :- David -- * Books: RAILS ROUTING (new! http://safari.awprofessional.com/9780321509246) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)