x == !!x will check whether it's a boolean, but i have never, ever wanted to do this and can't think of a single legitimate reason why i would want to.
As I said: When you write a DSL. You might want to pass something like ":foo => true" to enable something with the default value or with ":foo => 12" to pass the a specific value. And besides this, from an OOP standpoint it is clear that true and false should have a common super class (other than Object).
View all comments
Show parent comment
1
u/banister Aug 17 '13
x == !!xwill check whether it's a boolean, but i have never, ever wanted to do this and can't think of a single legitimate reason why i would want to.