On 11 July 2012 16:45, Robert Klemme <shortcutter / googlemail.com> wrote:
> On Wed, Jul 11, 2012 at 3:40 AM, Matthew Kerwin <matthew / kerwin.net.au> wrote:
>> My only request would be that you rename the method something like
>> 'create_lambda' (since you're not really casting s as such, you're
>> using it as a factory) or get_lambda (if you want to make the lambda
>> seem like a property of s).
>
> It's not a "get" since we actually create something.  I prefer
> #to_lambda (or #to_something_else) because it actually converts the
> object to something else (btw. #to_enum works similarly, i.e. by
> wrapping the instance at hand with something else which provides a
> particular interface).  Also "to" is shorter to type than "create".
> :-)

Rather. However I feel that if it's called #to_lambda it should be a
method of the _method_, since it's the method being bound to the
object, rather than the object being bound to the method call.  (And
therein was revealed the ultimate depth of the pedantry of the
debate...)

How about something imperative, like #lambdafy :
  baz.lambdafy(:foo, zing, ploink)
    #=> "baz, lambdafy method :foo, with parameters zing and ploink !"
You could call it #bind_method if you don't want people to balk. More
typing though.

On the obverse, I'd be perfectly happy if you called it #to_adbmal
since you're _inversely_ converting the object to a lambda, by binding
it to an instance of a method call.  Take that, colleagues!

-- 
  Matthew Kerwin, B.Sc (CompSci) (Hons)
  http://matthew.kerwin.net.au/
  ABN: 59-013-727-651

  "You'll never find a programming language that frees
  you from the burden of clarifying your ideas." - xkcd