Hi, 2010/10/8 "Martin J. Dst" <duerst / it.aoyama.ac.jp>: > I would understand that if it were [a, b, c].included? x > But it's include?, so the order seems just fine. Easy to read as > "does [a, b, c] include x?". Any other order would feel strange, wouldn't > it? I'm not talking about English, but a "subject" of a sentence. Because I think that the "subject" of this sentence is "x", I want to write "x" first, such as "is x included in [a, b, c]?". Consider Python's join: '-'.join(["a", "b", "c"]) I think that it is awkward NOT because it is unnatural English word order, but because an array (that is the "subject" of this sentence) appears later. > Also, an 'in?' method on Object has been proposed, so that you can write > x.in? [a, b, c] > That's very short, and fully object oriented pure Ruby, no syntactic sugar > necessary. Some people say that it is against OO. They say that Object class should not have "in?" method because "in?" is not a property of Object. Personally, I'm not against Object#in?, but I can also understand their opinions. >> 2) the idiom is too long (even though it is often used) > > I don't think Ruby method names are optimized according to usage frequency. Though there are many exceptions, Ruby certainly has a design principle ("akr theory" called in [ruby-dev:33558]) that encouraged methods should have short names. An extreme example is [ruby-dev:33553]. matz once suggested String#sg that is a reformed version of String#gsub. Though it was not committed. > Another way to do it would be: > ase http_request.http_method > hen :get, :post, :put, :delete > .. > nd I agree that case statement is a good idea. When I imformally suggested "in?" operator (on IRC or twitter), some people also suggested me to use case statement, and I was satisfied once. But there is still two problems; case cannot be postpositive, and cannot be used in else clauses (like "elsif"). An extreme example again: I heard that Sasada-san even created a patch for postpositive case statement: p "foo" case http_request.http_method when :get, :post, :put, :delete I believe that this shows that many people suffer from the word order problem, though "in" operator is much better than this syntax :-) -- Yusuke Endoh <mame / tsg.ne.jp>