On Sun, Dec 27, 2009 at 2:51 PM, Yehuda Katz <[email protected]> wrote: > My biggest concern with nonblank? is that idiomatic Ruby is to return a > boolean from question mark methods. I like Pratik's solution, and would like > to see a scenario where the short-circuit logic is important (and common > enough to justify an core class extension). > > Yehuda Katz > Developer | Engine Yard > (ph) 718.877.1325
Well IMHO, I think it's more idiomatic Ruby to have a predicate only worry about the truthiness or falsiness of what it returns. Any value other than nil or false is a perfectly good, and true return value from a predicate, and in many cases more useful. Insisting that a predicate return either true or false, smells more Java or C++ish than Rubyish to me. But what do I know? -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
