From: Daniel Brockman Date: 2005-07-16T08:54:49+09:00 Subject: Re: difference? Devin Mullins writes: > Well, is_empty? is different from is_a?, in that "a" is not a > property of the object -- rather, it's just part of a sentence-like > phrase. Hi Devin, Good point. You are right, of course. > I think the no "is_" convention just came about because it > was three characters that communicated nothing, and hence were > unnecessary. As you saw, #a? looks weird, so the "is_" communicates > something important in this case. You're right again. > But really, I don't care which you prefer. (No offense. :) I don't > have any problem with using is_a?, as it just plain looks more > readable to me. (It doesn't hurt that it's shorter, too. :P) Another argument against it is the fact that the indefinite article will be wrong for about half the cases (e.g., `foo.is_a? Array'). Yet another that it doesn't look very good when used with adjectival arguments (e.g., `foo.is_a? Enumerable'). Interestingly, `is?' works really well for adjectival arguments: foo.is? Enumerable foo.is? Observable It's actually not that bad for substantival arguments either: foo.is? String foo.is? Array (Note that `kind_of?' works well in all these cases: foo.kind_of? Enumerable foo.kind_of? Observable foo.kind_of? String foo.kind_of? Array) -- Daniel Brockman