"Austin Ziegler" <austin / halostatue.ca> wrote in message
news:2003814162351.292849 / PADD...
> Because () isn't really an operator -- at least not yet, and I don't know
> whether or not Matz will make it an operator. I'm not sure whether I'd
want
> it to be an operator. Maybe Matz can make it so that the [] syntactic
sugar
> for Proc can work with () as well.

I think I'm really asking the wrong question here. What I'd really like to
know about is "callable objects". The () is a syntactical construct that has
a different meaning in Ruby than in Python. In Ruby, () is optional. But
this isn't what I'm really asking. I'm asking how one might make an object
in Ruby behave like a method.

irb(main):001:0> f = lambda {|x| x + 1}
=> #<Proc:0x4022f524>
irb(main):002:0> f 5
NameError: undefined method `f' for #<Object:0x4024dce0>
        from (irb):2
irb(main):003:0> f.call 5
=> 6

I understand that everything lives inside an object, so there are no free
functions, but there are certainly methods that behave like free functions;
I can create one of those things using "def". What I can't seem to do is
pass that method around and still call it without referencing the object
it's attached to. Or can I?

Thanks everyone for the replies,
Dave