From: "Shot (Piotr Szotkowski)" Date: 2009-08-27T07:21:57+09:00 Subject: Re: doubling numbers with Object#object_id --sm4nu43k4a2Rpi4c Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable EbFFA: > I was playing with Ruby and wrote an interesting method: > def double n > n.object_id - 1 > end > Anyone know why this works? Why Ruby was implemented this way? Note that other Ruby implementations (JRuby, Rubinius, IronRuby=E2=80=A6) do not have to keep this contract; it=E2=80=99s best considered as MRI peculia= rity. But yes, I do find this design beautiful =E2=80=93 as well as Ruby=E2=80=99= s method lookup: http://www.viddler.com/explore/CobyR/videos/1/ =E2=80=94 Shot --=20 It is absurd to have a hard and fast rule about what one should read and what one shouldn=E2=80=99t. More than half of modern culture depends on wha= t one shouldn=E2=80=99t read. [Oscar Wilde, The Importance of Being Ear= nest] --sm4nu43k4a2Rpi4c Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqVtYEACgkQi/mCfdEo8UocTACfWONFO3O5Y94YvjgR/k06e4Px ASAAn3IxU0bLhYB5U2RpMlebyw5feJlm =Aw6n -----END PGP SIGNATURE----- --sm4nu43k4a2Rpi4c--