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

On Sat, Apr 30, 2011 at 02:15:15PM +0900, Chad Perrin wrote:
> On Sat, Apr 30, 2011 at 08:01:48AM +0900, Josh Cheek wrote:
> >=20
> > That's because methods are invoked by default, as I already stated.
> > You need a line that evaluates to the method, not to nil. Your issue
> > isn't with the objectivity of methods, it is with how you access
> > methods.
> >=20
> > # this is evaluated
> > puts                            # =3D> nil
> >=20
> > # now we have a reference to it
> > puts =3D method :puts             # =3D> #<Method: Object(Kernel)#puts>
>=20
> That's a wrapper -- not the method itself.

A little elaboration . . .

    class String
      def end_upcase
        self.split[-1].upcase       # This Line: Method
      end
    end

    'foo bar baz'.end_upcase        # String Before Dot: Object Literal
                                    # Thing After Dot: Message

The string of characters "end_upcase" in the above isn't even a method,
per se; it's a message, sent to the object that is the return value of
the expression preceding it.  The return value of an object literal is
the object literal.  The return value of a nonliteral object is the
object reference stored under whatever label/variable you use for it, or
the object that is returned by some other form of expression.

So . . . it is not only the case that methods are not objects; it is also
the case that the thing you probably think of as a method is not a
method.  It's a message, being sent to an object, which in turn probably
has a method defining how it responds to that message.

--=20
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]

--6TrnltStXW4iwmi0
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAk27oUIACgkQ9mn/Pj01uKV0cQCg5ImaeeRt8u/cIdRCHpYXq9uj
Wb8An3nNwCXoeEkmhApRSgPs3x8ArQHg
=/tnY
-----END PGP SIGNATURE-----

--6TrnltStXW4iwmi0--

On Sat, Apr 30, 2011 at 02:15:15PM +0900, Chad Perrin wrote:
> On Sat, Apr 30, 2011 at 08:01:48AM +0900, Josh Cheek wrote:
> >=20
> > That's because methods are invoked by default, as I already stated.
> > You need a line that evaluates to the method, not to nil. Your issue
> > isn't with the objectivity of methods, it is with how you access
> > methods.
> >=20
> > # this is evaluated
> > puts                            # =3D> nil
> >=20
> > # now we have a reference to it
> > puts =3D method :puts             # =3D> #<Method: Object(Kernel)#puts>
>=20
> That's a wrapper -- not the method itself.

A little elaboration . . .

    class String
      def end_upcase
        self.split[-1].upcase       # This Line: Method
      end
    end

    'foo bar baz'.end_upcase        # String Before Dot: Object Literal
                                    # Thing After Dot: Message

The string of characters "end_upcase" in the above isn't even a method,
per se; it's a message, sent to the object that is the return value of
the expression preceding it.  The return value of an object literal is
the object literal.  The return value of a nonliteral object is the
object reference stored under whatever label/variable you use for it, or
the object that is returned by some other form of expression.

So . . . it is not only the case that methods are not objects; it is also
the case that the thing you probably think of as a method is not a
method.  It's a message, being sent to an object, which in turn probably
has a method defining how it responds to that message.

--=20
Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAk27oUIACgkQ9mn/Pj01uKV0cQCg5ImaeeRt8u/cIdRCHpYXq9uj
Wb8An3nNwCXoeEkmhApRSgPs3x8ArQHg
=/tnY
-----END PGP SIGNATURE-----