From: Guoliang Cao Date: 2008-05-20T05:28:06+09:00 Subject: Method as first class member Hi, I don't consider myself a ruby guru but have been a ruby user for a few years. Since ruby 1.9 is out but its feature set is not finalized, guess it's ok to voice my opinions on what may be interesting to a joe user. Currently Ruby has 2 kinds of callable block - proc and lambda, which are slightly different on semantics. Other than those, is it possible to make methods work similarly (maybe like a lambda plus an implicit self parameter)? This will make it closer to the statement "everything is an object" - a method is an object too. This also makes Ruby a next level functional language I guess. To refer to the method object, we probably can use syntax like this: m = obj->do_something m[1,2,3] m = Dir->pwd m[] Method object may work similar to lambda and be passed as parameter. Down the way, partial invocation can be added by associating a context to the method object and memorizing parameter values. i.e. m = obj->do_something 1,2,3 m[] What do you guys think? any comments are welcome. Regards, Guoliang btw, I know ruby-core is the place to post but I don't have permission. I wonder how the permission is granted, by number of posts? -- Posted via http://www.ruby-forum.com/.