On Thu, 11 Aug 2005, David A. Black wrote:

>> The original poster had a NoThing type of nil. Your fear arises from the 
>> possibility of applying the empty? method to an Unitialized or 
>> NotApplicable type of nil.
>
> I would say that asking whether nil is empty is like asking whether 12
> is empty: it just doesn't mean anything.  Even having it say "false"
> suggests that "true" is possible.  In general, I don't think
> non-container objects should be declaring themselves "empty".

class Fixnum
   def each
     # I'm throwing this exception, not because it is required,
     # but because a headache is damping my imagination
     # as to what -1.each means. I think it means the something
     # like collect or sum, but my head hurts too much to say.
     raise "Negative number" if self < 0

     (1..self).each{|i| yield 1}
   end

   def empty?
     self == 0
   end
end

12.each {|i| puts i}

1
1
1
1
1
1
1
1
1
1
1
1


What does NoThing contain?

Obvious it contains NoThing.

noThing.shift returns noThing.

Is NoThing empty?

Yes.

It's all like non-euclidean geometry. Nobody could prove Euclid's 5 
postulate even though it was ugly enough to be a theorem not an axiom.

So some bright spark resolve to propose an alternative, intuitively wrong 
alternative to postulate 5 and then find the contradiction.

There wasn't one.

ie. Equally valid non-euclidean geometries exist.

The current axioms of "nil" are valid and consistent.

But more useful, equally consistent axioms of "nil" can be proposed.




John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter / tait.co.nz
New Zealand

Carter's Clarification of Murphy's Law.

"Things only ever go right so that they may go more spectacularly wrong later."

From this principle, all of life and physics may be deduced.