From: Clemens Hintze Date: 1999-07-26T08:11:36+02:00 Subject: [ruby-talk:00534] Re: Another way for this? And a new proposal! On Mon, 26 Jul 1999, you wrote: >Hi, > >In message "[ruby-talk:00532] Re: Another way for this? And a new proposal!" > on 99/07/25, Clemens Hintze writes: > [...] > >|>| def each(aBlock=(begin lambda rescue nil end)) >|>| @list1.each aBlock >|>| @list2.each aBlock >|>| end > >Well, it's ugly. I will remember it for future usage :-) But I will try to avoid it and use the `&' mechanism... [...] >| >| anyObject.anyMethod &blk >|or >| anyObject.anyMethod blk > >Use former. I think it's better way. 'def foo(block=lambda)' trick >is older than the block argument. Okay! Perhaps a hint in FAQ or another document for beginners like me? :-) It would be better, if there is a recommended way-of-doing. [...] >Blocks are not objects, so it's not possible to return blocks. As I >said before, Proc instances are objectified block, just like Method >instances are objectified methods which themselves are not objects. Okay! Now I have understood. Since I have thought all the time, that block also are objects (ALL things are object in Ruby ;-) I was not aware that the difference is exactly there: block aren't instances, Proc objects are! Thanks for your patient. :-) > > matz. Cle