[#77789] [Ruby trunk Feature#12012] Add Boolean method — prodis@...
Issue #12012 has been updated by Fernando Hamasaki de Amorim.
4 messages
2016/10/27
[ruby-core:77825] [Ruby trunk Feature#12515] Create "Boolean" superclass of TrueClass / FalseClass
From:
samuel@...
Date:
2016-10-31 03:35:23 UTC
List:
ruby-core #77825
Issue #12515 has been updated by Samuel Williams. It's also interesting to note, so many people are working around this: Searching on github for: "is_a? TrueClass FalseClass" gives 90,000 results. https://github.com/search?p=2&q=is_a%3F+TrueClass&ref=searchresults&type=Code&utf8=✓ "module Boolean TrueClass FalseClass" gives 63,000 results. https://github.com/search?utf8=✓&q=module+Boolean+TrueClass+FalseClass&type=Code&ref=searchresults Even I'm surprised by the number of people working around this issue! ---------------------------------------- Feature #12515: Create "Boolean" superclass of TrueClass / FalseClass https://bugs.ruby-lang.org/issues/12515#change-61129 * 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>