Dave Burt wrote:

>You can subclass NilClass, but it has no allocator, so you'd have to define 
>your own, and such an object still wouldn't be considered false in 
>conditionals. There is only one nil, and only one false. So there is no 
>point in subclassing NilClass.
>
>  
>
Yeah, I tried some of the same stuff Logan did in his email and finally 
realized that NilClass won't let you subclass it.

But, what if I did something like this:

class KBNil
    def method_missing(a,b)
        nil
    end

    def nil?
        true
    end
end

Then, since, nil and false are the only things that don't evaluate to 
true, if you do:

k = KBNil.new

puts 'True!' if k > 300 or 800 < 900    # True!

puts 'False!' unless k > 300 or 800 < 900    # False!

puts 'False!' unless k =~ /bob/    # False!

puts 'False!' unless k < Date.today    # False!

k.nil?    # true


I'm just thinking off the top of my head, but what do you think about this?

Jamey