On Mon, 28 Oct 2002 06:56:51 +0900, Massimiliano Mirra wrote:
> On Sun, Oct 27, 2002 at 10:07:31AM +0900, Phil Tomson wrote:
>> Anyway, I guess I'm in the camp that would like to see some kind
>> of hierarchy like:
>> 
>> class Boolean; end
>> class TrueClass <Boolean; end
>> class FalseClass <Boolean; end
>> 
>> Then there would be some kind of type relationship between
>> TrueClass and FalseClass. That would just seem to make more sense
>> to me, but I do see the potential pitfalls with that approach
>> too.
> I'm wondering what happens when subclassing Boolean a third time.
> 
> What would the relationship be among this third class and
> FalseClass and TrueClass? And what relationship among its instance
> (or rather its singleton) and `true' and `false'?
> 
> Does a class model actually make sense here?

Yes, and no. From the perspective of set ordering, absolutely. From
the problem of allowing two and only two subclasses from an abstract
class (which is what should be allowed), no. Perhaps the appropriate
solution might be to still have two independent singleton classes
(TrueClass, FalseClass), but also have a helper class Boolean that
programmatically defines the Boolean relationship as a "set" (an
Array, in this case:

    class Boolean
        import Singleton
        @@order = [false, true]
    end

Maybe. The class would have to be frozen and somehow not
subclassable, but that seems like it would allow the sometimes but
rarely necessary ordering/comparison between true and false values.

-austin
-- Austin Ziegler, austin / halostatue.ca on 2002.10.28 at 00.18.31