From: David Chelimsky Date: 2006-10-06T20:28:48+09:00 Subject: Re: nil being empty On 10/5/06, Ohad Lutzky wrote: > Show of hands - who thinks this is bad form? > > class NilClass > def empty?; true; end > end Doesn't it depend on context? The other responders seem to suggest that is objectively bad form, with which I can agree (generally), but in a case like this: collection.select do |item| item.respond_to?(:empty?) and (!item.empty?) end I might prefer collection.select do |item| true unless item.empty? end or this (which, though more terse, I personally find less readable) collection.select do |item| !item.empty? end One of the beauties of the language (for me) is that language invariants become somewhat less "in" and more "variant".