From: Dan Doel Date: 2003-08-16T12:56:30+09:00 Subject: Re: Overloading () Aredridel wrote: > That's something I'd been wondering -- it came as a surprise to me that > >all methods aren't first-class objects. Of course, I was used to >needing to pass method handles around from all my time spent in PHP, and >since using Ruby, haven't needed that even once. > >I think the biggest thing is that methods-as-objects, or lambdas as >objects are a functional programming artifact, which doesn't mesh with >OO very well at times. I think this is one of those cases. > I suppose that depends what you mean. Technically methods are first class in Ruby because you can pass them around as objects. Blocks are first class as well when converted to Proc objects, and they serve the same functions as lambda constructs in functional languages. I agree with what you're saying, though. Methods don't exactly "feel" first class in Ruby, since you need to call #method to get the object, and you can't use those objects interchangably with method calls. It works better this way within the context of Ruby, but it seems very different when comparing it to a pure functional language like, say, Haskell. It's somewhat unfortunate that it's difficult to get certain very useful concepts to mesh together perfectly, but I suppose that's just the way things are. - Dan