jobeicus / hotmail.com (Joseph Benik) writes:

> class Foo
>    def test
>       print "hi\n"
>    end
> end
> 
> f=Foo.new
> 
> 
> I would like to alias a function newtest to refer to f.test but don't
> know how...  for example:

You can't alias it in such a way as to have the receiver
implicit. However, you can take a reference to it and use that without
a receiver:

    class Foo
       def test
          print "hi\n"
       end
    end

    f=Foo.new

    fn = f.method(:test)
    fn.call
    # or
    fn[]


Not quite as transparent.


Dave