On Tue, Oct 4, 2011 at 10:36 PM, Dean Landolt <d...@deanlandolt.com> wrote:
> > > On Tue, Oct 4, 2011 at 5:12 PM, John J Barton <johnjbar...@johnjbarton.com > > wrote: > >> >> >> On Tue, Oct 4, 2011 at 12:59 PM, Bob Nystrom <rnyst...@google.com> wrote: >> >>> >>> A constructor is different from a regular function. Instead of returning >>> the value that the body of the function returns, it returns a special >>> newly-created object. >>> >> >> Sorry, already you lost me ;-) I guess you mean the operand of "new"? If >> so, then the different thing is the operator 'new'. It's "new" that makes >> the operand a constructor. >> >> >> >>> Likewise, a generator is a special function that doesn't return what the >>> body returns. >>> >> >> But it does not look special. There is nothing similar to 'new' involved >> in the invocation of the generator. >> >> >>> Instead, it returns an object that lets you interrupt and resume that >>> function. This object exposes a next() method. When you call that, the >>> function runs until it hits a yield. When it does, the function is >>> paused at that point, and the result of the yield is returned from >>> next(). The next time you call next() it picks up from there and >>> continues. >>> >> >> and the state of the generator is hidden from the developer as far as I >> can tell. >> >> I think generators are an excellent example of a feature that is well >> prototyped (in FF JS 1.7+). I think the developer uptake is minimal, outside >> of the original advocates. >> > > Of course uptake is minimal -- it's only in one engine, and even then it > doesn't yet match the spec. > Err -- whoops, almost forgot about rhino. But my point still stands. > > >> I don't hear any clamor for other browsers to implement this feature. If >> generators never go further, that is an awesome outcome and we owe Dave >> Herman and other proponents of generators a lot of thanks for their >> efforts. Either way, "class" deserves at least as much investigation. >> >> jjb >> >> _______________________________________________ >> es-discuss mailing list >> es-discuss@mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> >> >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss