From: "David A. Black" Date: 2007-12-03T16:17:58+09:00 Subject: Re: Generator#yield - what does it do? --1926193751-196511545-1196666283=:18257 Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-196511545-1196666283=:18257" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1926193751-196511545-1196666283=:18257 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Hi -- On Mon, 3 Dec 2007, Wolfgang N=C3=A1dasi-Donner wrote: > Jordan Callicoat wrote: >> On Dec 2, 5:03 pm, Wolfgang N=EF=BF=BDdasi-Donner = wrote: >>> It's unclear for me what this means. I would expect that the Generator >>> object delivers (yields) values by requirement through >>> "Generator#current" or "Generator#next", but what should be yielded to >>> an already existing Generator object? >> It's for passing items *into* the generator's queue when the generator >> is created with the block form of Generator#new rather than from an >> existing enumerable. Example... > > I see - the confusion came from the usual meaning of yield: call a block > and deliver objects to it. Here it is used from a block into a method. > > btw. - at least in "PickAxe" the word "yield" it marked as a reserved > word. Reserved words can still be method names (e.g., class). It would be nice to have a different word for this method, since it does feel a bit backwards in relation to the other "yield", but as I recall there have been discussions already and nothing that Matz liked was proposed. David --=20 Upcoming training by David A. Black/Ruby Power and Light, LLC: * Intro to Rails, London, UK, December 3-6 (by Skills Matter) See http://www.rubypal.com for details and 2008 announcements! --1926193751-196511545-1196666283=:18257-- --1926193751-196511545-1196666283=:18257--