On Mon, Nov 14, 2011 at 07:08, Sylvester Keil <sylvester.keil / gmail.com> wrote: > Because I wanted the predicate-setters to be chainable, I made them return self > always. For instance, I had a Name class that printed names according to > different formatting rules and I wanted to write things like: > > name.sort_order!.to_s #-> set name to sort order formatting and convert to string The general idea may be OK, but at least this particular case is a bit jarring. Reading it, it looks like it sets the sort order to some default (as opposed to name.sort_order!(Name::Sort_Lexical).to_s), and converts *that sort order* to a string. IIUC what you're saying, it would set the sort order, and convert the *name* to a string. The ! is a bit easy to miss. I think what's irking me may be that the particular method name looks (if you miss the !) like it's referring to *extracting* state rather than *setting* it. name.set_sort_order!.to_s or name.with_sort_order!.to_s might set more correct expectations -- at least for me, as YM is almost guaranteed to V with something this subjective. -Dave -- LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages. Where: Northern Virginia, Washington DC (near Orange Line), and remote work. See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence). Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)