On Tue, Aug 01, 2006 at 06:15:10PM +0900, Just Another Victim of the Ambient Morality wrote: > > Well, I think that meshes just fine with my take on it... > To tell you the truth, I didn't expect you to ask me what my > understanding of a closure is because I thought I had already demonstrated > it with the code sample I gave. Of course, you're busy digesting that and I > appreciate it. It means you're actually trying to understand me (rather > than just arguing at me. Something that happens all too often...). > If I may be so bold, I think that, perhaps, blocks don't look like > closures to you because you don't realize that methods that take blocks, > like "each," "inject," "collect," etc.. are methods (member functions, if > you're a C++ guy) and not arbitrary language constructs, like "if," "while," > "for," etc... I'm not exactly a C++ guy. I suppose I'm more of a Perl guy than anything else, judging by my familiarity with languages and the assumption of a lack of loathing (I'm as familiar with PHP as with Perl, but I don't like it very much, for instance). I am familiar with many of the idioms and much of the semantic and syntactic theory of a lot of languages, even if I don't use them much, though. The dangers of doing consulting and industry analysis for money. . . . > > Now that I think about it, this whole argument can be settled with one > simple question. If you doubt that all blocks are closures then show us a > counter-example. Show us a "block" that is not a closure and I will show > you how it's not a block... Is this a closure? You tell me (and tell me how, if it is): array.each do || puts "Hello world!" end -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] print substr("Just another Perl hacker", 0, -2);