Joel on Software "Don't Let Architecture Astronauts Scare You" by Joel 
Spolsky http://www.joelonsoftware.com/articles/fog0000000018.html


On 10/31/2016 06:08 PM, samuel / oriontransfer.org wrote:
> Issue #12515 has been updated by Samuel Williams.
>
>
>> It's a choice by that library author. They are not classes but methods, there can be Boolean method in the library.
> Nobu, you are not looking deep enough.
>
> https://github.com/jeremyevans/sequel/blob/c39594dd35b3f8a8975b05be156ba664f1630804/lib/sequel/database/schema_generator.rb#L57-L61
>
> The author makes methods to produce the types. The type name must be the same. My feeling is that if a Boolean type existed, they would prefer it.
>
>>   "Distill the essential from the mass of
> confusing muchness. Nothing may be missing and nothing may be
> extraneous. This is the definition of elegance."
>
> Yes, and if you apply this logic, why have two classes when one would be better in every way?
>
>> There is no value in defining a Boolean superclass of both **TrueClass and FalseClass**.
> There is value in the check `x.is_a? Boolean`.  The value is in the check itself, finding out if x contains [true, false]. And the value is in the consistency that there is a single class name "`Boolean` which is polymorphic over the set of classes `Integer`, `Float`, `Numeric`, `String`, etc, which are used over and over again in code which does formatting, type checking, serialisation, deserialisation, database modelling, etc.
>
> The evidence is overwhelming. There are 150,000 instances of code working around the lack of Boolean on GitHub. At what point do you draw the line and say "Yeah, enough people are doing this, it might make sense to bring this into the core language".
>
> No other language structures booleans around a "TrueClass" and "FalseClass":
>
> - Python has `bool` data type.
> - C has `#include <stdbool.h>`
> - C++ has `bool`
> - Java has `bool` and `class Boolean`
> - JavaScript has `Boolean`
> - Smalltalk has `Boolean`
> - CLISP has `BOOLEAN`
>
>> but I say, "People already live with that possibility and seem to be surviving just fine."
> Is Ruby a language just to survive or is it a language to provide the tools programmers need to be happy?
>
> I say, that every person who wrote their own Boolean class, wasted an hour of their time trying to figure it out. On GitHub, there are 2,080,658 results for "class Boolean". I know it's an overestimate, but that gives us an upper bound of 228+ years of programmer time. Matz, how can you live with yourself :D (purely for comic effect, honestly we all love you).
>
> ----------------------------------------
> Feature #12515: Create "Boolean" superclass of TrueClass / FalseClass
> https://bugs.ruby-lang.org/issues/12515#change-61155
>
> * 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
> ~~~
>
>
>
>


Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>