From: ara.t.howard@... Date: 2006-10-06T23:07:58+09:00 Subject: Re: nil being empty On Fri, 6 Oct 2006, Trans wrote: > Ohad Lutzky wrote: >> Show of hands - who thinks this is bad form? >> >> class NilClass >> def empty?; true; end >> end > > Put your hands down. Notice that everyone that says it's bad form is doing > so on purely ideological basis. I challenge them to show one good > _practical_ case where it's truly "bad". And no, purposefully expecting a > NoMethod error doesn't count --that IS bad form. hash_of_lists = Hash.new{|h,k| h[k] = new_list} hash_of_lists[:key] << 42 if hash_of_lists[:key].empty? -a -- in order to be effective truth must penetrate like an arrow - and that is likely to hurt. -- wei wu wei