On 31 May 2007, at 04:46, Chad Perrin wrote: > On Thu, May 31, 2007 at 11:30:30AM +0900, Michael W. Ryder wrote: >> >> While I realize the Ruby is not C, I think that some of the style >> guidelines for C should still apply in Ruby. One of the ones that >> was >> very important was to make each statement do only one thing. Your >> example of setting a temporary variable to an amount on one line and >> then testing that variable on the second line is much easier to read, >> and understand, quickly than your statements like 'return %$ >> unless f(n) >> == x'. This becomes even more important when the test is even more >> convoluted such as checking for the position of a string in another >> string and returning if it is in a specific location. > > I'm afraid I must disagree. The only thing I find "unreadable" about > that is the complete lack of obvious association between %$ and the > source of the value it contains/labels. The composition of the > expression itself, such that the condition test is on the same line as > the rest of the action, produces absolutely zero difficulty for me. Well as I said in my original post, %$ was intended purely as a placeholder. I did also consider <= which could play an analogous role to => in hash literals but it looked even stranger. Another possibility would be: return f(x) if != y return f(x) unless == y which would complicate the parser but is quite readable. Ellie Eleanor McHugh Games With Brains ---- raise ArgumentError unless @reality.responds_to? :reason