--E/DnYTRukya0zdZ1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Nov 11, 2010 at 04:51:46PM +0900, Josh Cheek wrote: > On Wed, Nov 10, 2010 at 11:55 PM, timr <timrandg / gmail.com> wrote: > > > > Alex said everything is an object--including an instance of a class, > > the class itself, its methods. I agree up until he mention methods as > > objects. I don't think that can be demonstrated. For instance, we > > cannot get the object_id of a method. '+.object_id' doesn't work. So, > > I don't agree that methods are objects. > > > 1.method('+').object_id 1.method('+') is not the same as 1.+, so your example does not prove + is a method. The object ID you get with 1.method('+').object_id is actually the object ID of the object that is returned by the method "method" when it is passed an argument of the string "+". That is not the same thing as an object ID for the + method itself. Here's a thought experiment for you: If + is an object, and 1.method('+') returns that object so that you can get its object ID with 1.method('+').object_id, this should work: > foo = 1.method('+') > foo(3) 4 > Fire up irb and try it, now. It doesn't work. Instead, if you want to use it, you need to do this: > foo = 1.method('+') > foo.call(3) 4 > That's because a "method object" is not a method; it is a proc that wraps the method and its scope context. -- Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --E/DnYTRukya0zdZ1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkzcrZ0ACgkQ9mn/Pj01uKUc6gCfZwNVMWpLWZ40YIQPoiqVQq5r 61MAmwU7fvIFJJfYFfbADH4KPEIn2jic j -----END PGP SIGNATURE----- --E/DnYTRukya0zdZ1--