From: nobu@... Date: 2016-10-31T06:24:14+00:00 Subject: [ruby-core:77836] [Ruby trunk Feature#12515] Create "Boolean" superclass of TrueClass / FalseClass Issue #12515 has been updated by Nobuyoshi Nakada. Samuel Williams wrote: > Having a class named `Boolean` would make things more readable, for example here: http://sequel.jeremyevans.net/rdoc/files/doc/schema_modification_rdoc.html#label-Column+types - you can see that because there is no `Boolean` class, they resort to, IMHO quite a strange naming convention, using either `TrueClass` or `FalseClass`. It's a choice by that library author. They are not classes but methods, there can be `Boolean` method in the library. Not providing such method is the choice by the author. > The naming of `TrueClass` and `FalseClass` are also inconsistent with other names, e.g. it's not `IntegerClass` or `FloatClass` or `StringClass`. It's a little bit ugly. (EDIT: or `ZeroClass`, `OneClass`, etc :) Indeed. We don't need the names for singleton classes of `true`, `false`, and `nil`, and should remove them all. ---------------------------------------- Feature #12515: Create "Boolean" superclass of TrueClass / FalseClass https://bugs.ruby-lang.org/issues/12515#change-61146 * Author: Loren Segal * Status: Rejected * Priority: Normal * Assignee: ---------------------------------------- Since Ruby 2.4 is unifying Bignum/Fixnum into Integer (https://bugs.ruby-lang.org/issues/12005), it seems reasonable to do something similar for TrueClass / FalseClass, and create a proper Boolean hierarchy. The implementation would be fairly straightforward and should be back compat unless someone already has a "Boolean" class at toplevel out there. Given the compatibility implications of Integer, this Boolean proposal is even less intrusive. Sample implementation: ~~~ class Boolean < BasicObject; end class TrueClass < Boolean; end class FalseClass < Boolean; end ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: