From: Tom Sawyer Date: 2002-12-28T15:10:33+09:00 Subject: Re: viral arguments On Friday 27 December 2002 03:11 am, W. Kent Starr wrote: > If I am understanding you correctly, Ruby has this mechanism already. > It is called a "block" (much better sounding than "viral" is it not?) ... > Thus, no argument returns a predefined default > Argument returns defined behavior operating on argument > Block returns returns operation on variable i > > Note & in front of block names (bar and baz); this tells Ruby a block > has been passed (given). The block_given? method in the if statement > tests for that. > > This is a very powerful feature; there are a lot of possibilities. Play > araound, experiement and enjoy. Kent, this is kind of like what i'm talking about. blocks are very powerful indeed, and i have used blocks many a time. the differenece between this and my idea though is that, with blocks, one must pre-program the method to deal with the incoming block. my notion dosen't have this requirement. of course david's right, my example is poor in that the viral argument shouldn't be able to access local variables, only public accessable methods. -transami