Operator function for getting boolean value of object

@arocnies , thanks for your thoughts. I actually feel similarly that I wouldn’t want truthy-ness for most objects. For example, I would never want if (Repository()) instead of if (Repository().isActive). I like code to be easy to read and also to make sense, like reading english. if (Repository()) could just as easily mean if (Repository().isNotEmpty()), and that creates lots of confusion.

The reason I brought this is up is because I have the following:

class TestSwitch(val key: String) {
  val isEnabled by lazy { System.getProperty(key, "false").toBoolean() }
}

val ManualTests = TestSwitch("DO_MANUAL_TESTS")
val StageTests = TestSwitch("DO_STAGE_TESTS")
val ChromeTests = TestSwitch("DO_CHROME_TESTS")

This is just some code to help me control which tests I am running during a particular test execution. I saw if (StageTests.isEnabled) and thought to myself that in this particular case, if (StageTests) made sense to me.

But given this is such an isolated example, and also that if (StageTests.isEnabled) doesn’t actually look that bad and reads well, I’m happy to accept the way it is :slight_smile: