Sure it works like that because they belong to the same scope, but you can
have some global that you specify for the send.

Class Mhf

    def Mhf.sq(x,y)
        x+y
    end
end

and latter Mhf.send(:func)

Ralph

----- Original Message -----
From: "MikkelFJ" <mikkelj-anti-spam / post1.dknet.dk>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>; <undisclosed-recipients:>
Sent: Friday, November 30, 2001 2:15 PM
Subject: [ruby-talk:27009] Re: first class functions in Ruby


>
> "Ralph Mason" <ralph.mason / telogis.com> wrote in message
> news:135701c1792a$679ffc90$0101a8c0 / p3...
> > irb(main):010:0> def sq(x)
> > irb(main):011:1> x+x
> > irb(main):012:1> end
> > nil
> > irb(main):013:0> def aMes(f)
> > irb(main):014:1> send(f,42) + send(f,27)
> > irb(main):015:1> end
> > nil
> > irb(main):016:0> aMes :sq
> > 138
> > irb(main):017:0>
> >
> >
> > Like that?
>
> wait - this only works because aMes and sq belongs to the same scope.
> It is not really the method that is being passed, just its name. Right?
> If I'm correct, it is not really suitable for acting as eventhandler in
> other objects.
>
> MikkelFJ
>
>
>
>
>