Dave Thomas wrote:

# If we're in to hooks, there's another that might be useful:
# 
#   to_bool:
#      analogous to to_s, called whenever an object is used in a context 
#      that requires a boolean value (this one came up on
#      #ruby-lang). Masochists could use this to emulate Perl
# 
#         class Numeric
#            def to_bool
#              self != 0
#            end
#         end
# 
#         class String
#           def to_bool
#             self != "0"
#           end
#         end
# 
# 
# This could get rolled in to the new Boolean class (or whatever it
# will be called).
# 
# 
# (So, let's see whose idea I've stolen this time :)

If you really don't recall, that sounds more like parallel invention
to me--something which has been occurring with noticeably increasing
frequency since the scientific and industrial revolutions. Most people
know about the  2 famous inventors of the calculus, but there were
actually 4, one of whom was Austrian and one of whom was Japanese,
IIRC. Sorry, I have no URL for this--I read about this in the
pre-Internet dark ages.

Anyway, I think you are probably on pretty safe ground here, because
this is something that I missed from Perl, and I think I would have
remembered if someone had suggested a nice way of dealing with it.

Conrad Schneiker
(This note is unofficial and subject to improvement without notice.)