From: Joe Van Dyk Date: 2005-12-23T09:16:58+09:00 Subject: Re: correct terminology for a function that yields On 12/22/05, Edward Faulkner wrote: > On Fri, Dec 23, 2005 at 09:00:31AM +0900, Joe Van Dyk wrote: > > def foo > > yield > > end > > > > foo do > > puts "hey" > > end > > > > > > What's the correct description of what is going on there? I've got a > > function foo. No arguments, right? Does it "take a block"? I know > > it gives control to the block, but I'm not sure of the correct > > terminology to use. > > It does indeed "take a block". The block argument is implicit. You > could make it explicit if you wanted to: > > def foo(&blk) > blk.call > end > > In more general terms, any function that takes another function as an > argument (or returns one as a result) is known as a higher-order > function. Ok, thanks. I'm writing documentation for a domain-specific language (in Ruby) that I created. People who use it are probably programmers, but may not be experienced with Ruby, so I wanted to explain a little bit about what's going on behind the scenes.