TITLE ===== class Boolean ABSTRACT ======== Create a Boolean superclass MOTIVATION ========== Type checking is a pain and you cannot currently subclass TrueClass or FalseClass, which is too restrictive. PROPOSAL ======== Create a Boolean superclass and make TrueClass and FalseClass subclasses of Boolean as well as allow custom subclasses of Boolean. RATIONALE ========= Currently, checking return values for methods that return true or false is a bit of a pain because there is no way to use a single #is_a? One must do "if foo.is_a?(TrueClass) || foo.is_a?(FalseClass)" which is cumbersome and too verbose. In addition, you cannot currently subclass TrueClass or FalseClass. A Boolean superclass would allow us to define our own Boolean subclass. Such an ability would be useful for defining our own semantics for what 'true' or 'false' is, above and beyond "true is true and not nil", which we could then apply to objects. Consider the case of Oracle PL/SQL. In Ruby, nil is false. However, in Oracle PL/SQL you have a Boolean data type that is either true, false or null (i.e. unknown). Having a Boolean parent class could make object-relational mapping layer packages easier to design. It could also be useful in DBI itself, where I could retrieve data from a column with a NULL value as nil, but which wouldn't equate to false. From there I can perform tri-state code logic, ala PL/SQL. For example, consider a table with a VARCHAR2(1) column called "is_deceased" for a list of movie actors and actresses. I could either have 'Y' or 'N' to indicate true or false. But if there's no constraint on that column *it could also be NULL*, which is NOT the same as false. See what I mean?