On Sat, Apr 26, 2014 at 2:52 PM, Brendan Eich <bren...@mozilla.org> wrote:
> Mark S. Miller wrote: > >> Regarding the points: >> >> #1 yes, we cannot provide one that's reliable, so let's not claim that it >> is reliable. >> > > Indeed it is not safe, even excluding yield, to assume finallys run in > browser contexts, unless you can prove termination of trys (which is hard, > right? Halting problem and all that). > > > #2 yes it does. I acknowledge that this is a genuine cost. >> > > I think I can make your case stronger: without |return| one cannot be sure > a generator iterator |it| parked at a yield won't resume some time later. > To ensure that it is really "done", call it.return(). Might this be > important for reasoning about security? > Plausible! > > BTW, return() should be idempotent. Is it? Since .return takes an argument whose value is observable, I think not. Hmmm. This is interestingly similar to multiple calls to resolve. > > #3 for those rare cases where it is inappropriate, like this example, >> better not to use a for/of anyway to make the unusualness of this code's >> purpose more explicit. >> > > Definitely -- given the implicit @@iterator call from (among other places) > for-of constructs, it's best with for-of loops to avoid any reuse of the > iterator later. Such hinky multi-loop consumption of a single iterator > should be considered bad style. One can still do it, of course. > > /be > -- Cheers, --MarkM
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss