--bWTBxx0QKOXH2iZ2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2006.10.28 00:20, Phrogz wrote:
> Eero Saynatkari wrote:
> > Is it possible to change NilClass#to_s to return "nil"
> > rather than "" since "" != nil?
> 
> 1) #to_s should always return a string.

Right.

> 2) Any string representation will always be a truth value.

Yep.

> The same situation exists for false:
> !!false.to_s  #=> true

true.to_s  # => "true"
false.to_s # => "false"
nil.to_s   # => ""

"" is not a valid representation of nil. "nil" is.

> You are correct that "" != nil, but "nil" != nil also.
> What are you really trying to achieve? And, did you know that
> nil.inspect yields "nil"?

Yes. I want consistency.

--bWTBxx0QKOXH2iZ2
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFQjN57Nh7RM4TrhIRAr8TAJ0UFae1AFHsxPJ4H9naDEt5iXXHpQCg67Lh
KSvdnW6VJyAJcLYvi9cw93MWD
-----END PGP SIGNATURE-----

--bWTBxx0QKOXH2iZ2--