From: "David A. Black" Date: 2005-03-21T21:27:43+09:00 Subject: Re: Paul Graham recommends Ruby Hi -- On Mon, 21 Mar 2005, gabriele renzi wrote: > David A. Black ha scritto: > >> I admit that for...in analogies don't do a whole lot for me -- it's >> not my favorite :-) But I don't think the case is exactly the same. >> It's not so much the call/() thing as the method/lambda thing that I >> find incongruous -- that is, putting () after a variable that refers >> to a lambda and have the variable sort of morph into the equivalent of >> a method name. Or something like that. > > notice that it is not a lambda thing.. is something done for callable > objects: > >>> a='yu ' > => "yup" >>> def a.call( other) 'yuk yukl' end > => nil >>> a 10 > => "yuk yukl" > > I think of it as to_str, a way to duck type a callable. But this notion of "a callable" collapses things which really aren't the same. If I can do this: a = Object.new; def a.call(x); end def b(x); end a(10) b(10) but I can't do this: c = [a,b] because one of these is an object reference and the other is a method identifier, then the parallel is only partial and, in my view, causes more problems than it solves. If lambdas and methods were completely unified, and really flowed into each other, that would be different. But this is a kind of selective magic that obscures a difference between them without redesigning the difference away. David -- David A. Black dblack@wobblini.net