On Mon, 3 Mar 2003 11:14:21 +0900, Yukihiro Matsumoto wrote: >|So I can't compare a date with nil, because I get an error. Instead I >|have to write something like date.instance_of? NilClass, which is >|something unnecessary complicated. >| >|Why is this implemented this way? > > Why do you want to compare date with nil, when nil <=> date raises > NoMethodError? Although it is better complied to other part of Ruby, > if it returns nil instead of raising exception. Because in this specific case I don't know whether this variable is uninitialized (nil) or is a Date or something else. I write a database library and I check if the values I am inserting are not null. If they aren't, the only data type I have problem with is Date, because I can't compare it with nil. -- Marek Janukowicz