From: Robert Dober Date: 2010-06-04T02:00:04+09:00 Subject: Re: dynamicaly define a method which body can contain yield On Thu, Jun 3, 2010 at 6:22 PM, Regis d'Aubarede wrote: > Robert Dober wrote: > >> in 1.8. you have to do some nasty tricks with converting methods to >> blocks or use simply "eval" or "module_eval" with a string. >> > > I  try actualy with 1.9, but no solution by the way ... > -- ok my bad, you call yield in the "client" block, that cannot work, let us look at what yield really is def implicit yield # invoke the block provided by the client end def explicit &blk blk[] # or blk.call, here it is clearer end now on the client side implicit{ yield } # what shall be invoked here??? obviously explicit{ blk[] } cannot work as blk is the block you provide here, right. Does this make your problem clearer? HTH R. now if you call ex > Posted via http://www.ruby-forum.com/. > > -- The best way to predict the future is to invent it. -- Alan Kay