drbrain (Eric Hodel) wrote:
> Issue #6180 has been updated by drbrain (Eric Hodel).
>
> Why do you need to convert objects to boolean values?
1. To avoid breaking encapsulation. For example:
def connected?
!! @sv
end
In the above, @sv is an internal resource the caller is never intended
to access.
2. To avoid looking obnoxious in logging statements.
@logger.trace("#{self.class.name} - #{__method__}: forcing reconnect, current status: connected=#{client.connected?.inspect}")
I want that to print: "current status: connected=false"
Not: "current status: connected=<page of dumped data of object internals>"
Personally I don't mind !! as once one learns the idiom, its intent
would seem to be fairly unambiguous.
Regards,
Bill