From: Martin DeMello Date: 2004-07-10T15:02:32+09:00 Subject: Re: Functional Ruby (Re: Why I don't use Ruby.) Sean Russell wrote: > > Once again, if you remove the semantic difference between a "method" > and a "function", you render both useless. A method is a message sent > to an object, which then reacts and exhibits some behavior. A > function is something that operates on some (optional) argument -- the > functionality is in no way bound to the object. One would say that > given: > > Ruby: > class Obj > def foo ; end > end > > Haskell: > foo :: Obj > > In Ruby, Obj *knows* about, and is intimate with, foo, which in turn > knows about Obj[1]. In Haskell, foo() knows about Obj, but Obj knows > nothing about foo. I'd say that the difference between a function and a method is that a method has a distinguished argument, 'this', *within whose scope it runs*. It's not a matter of Obj knowing about foo, or foo knowing about Obj, it's a matter of Obj defining its own personal scope within which foo is run. martin