From: dblack@... Date: 2006-07-05T20:00:08+09:00 Subject: Re: About 1.9 #__method__ feature. Hi -- On Wed, 5 Jul 2006, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: About 1.9 #__method__ feature." > on Wed, 5 Jul 2006 06:26:14 +0900, ara.t.howard@noaa.gov writes: > > |> obj.funcall(:foo, 5) # Success. funcall can call private. > | > |what improvement does that give over > | > | obj.instance_eval{ send :foo, 5 } > | > |?? > > Succinctness. Until people start saying, "Wait -- I thought these things were called 'methods' in Ruby. What's a 'function'? Is it a method? Is it just a method without an explicit receiver? And does that mean you can never 'funcall' a setter method, since they *always* require an explicit receiver? But when you 'funcall' a symbol, you're not using method-call syntax anyway, so the idea of an 'explicit receiver' is irrelevant and meaningless. Is there a 'function' method, similar to 'method' but including private methods? But why are private methods called 'methods' at all, if they're 'functions' in 1.9?...." Then it gets less succinct :-) I'm afraid I still don't know the answers to these questions. I do understand the "functional style" method call (though I don't understand how it relates to "funcall", since funcall isn't done in a functional style). But I've always thought that functional style was one of these things that grew organically out of the design of the language, without having to be named and ingrained at the language level: method call + situation where implied receiver can (or must) be used ---------------------------- = functional style Now it seems like this: method call <-------------------------------- % explicitness of receiver ^ ------------------------ ^ = whoops -- "method" should have been "function" ^ and also: obj.funcall(:meth) % if this were a lexical method call, would the receiver have been explicit? ---------------------------------------- = decision whether "funcall" was calling a method or a function It all seems so non-linear, doesn't it? David -- "To fully realize the potential of Rails, it's crucial that you take the time to fully understand Ruby--and with "Ruby for Rails" David has provided just what you need to help you achieve that goal." -- DAVID HEINEMEIER HANSSON, in the foreword to RUBY FOR RAILS. Complete foreword & sample chapters at http://www.manning.com/black!