about Boolean • Know more about language • The design principle of programming languages • Decision of NOT adding Boolean class • (And How Matz thinks about this???) • (In the original talk, Matz wasn’t there)
class for true and false object, respectively • These classes are “singleton” classes that have only one instance, not having `new` method • TrueClass and FalseClass don’t have a common parent class • There is no method such as `to_bool`, but we can use `!!expr` idiom • Any object, not only true and false, can be used with `if` expression (false and `nil` are falsy, every other object including empty string and 0 are truthy)
and false are immediate values (not objects, no classes) in Java • In some languages, only `true` and `false` can be used for `if` statement (Java, Haskell, etc.) • In some languages, there are methods to convert objects into boolean values (Python, JavaScript, etc.)
introduced Boolean class. I don't want to break them. true and false are the only representative of true-false values. In Ruby. nil and false are falsy values, and everything else is a true value. There's no meaning for having
introduced Boolean class. I don't want to break them. true and false are the only representative of true- false values. In Ruby. nil and false are falsy values, and everything else is a true value. There's no meaning for having a superclass of TrueClass and FalseClass as Boolean. Matz. ʢUnderscored by the speakerʣ
introduced Boolean class. I don't want to break them. true and false are the only representative of true-false values. In Ruby. nil and false are falsy values, and everything else is a true value. There's no meaning for having
“Guild” • Game developers complained that they already use “Guild” class • Recently added “Data” class was occupied by Ruby itself so it was safe • Adding “Boolean” may destroy other “Boolean” classes
and false share nothing • There’s no meaning of a superclass for them • Few use cases • `is_a?(Boolean) might be the only one • Compatibility issues • Naming is hard
In the issue, many developers express their thoughts and ideas • Not always “correct answer” • “This should be useful” might not be a right reason to add something • Ruby is different from other languages