Iteration protocol: a sentinel value?

André Bargull andre.bargull at udo.edu
Tue May 14 00:20:38 PDT 2013


The sentinel cannot carry a return value, from the notes:

> DH: Mark's proposal is broken, because it doesn't work with return 
> values of generators.
>
> MM: Agreed.
>



> In the TC39 meeting notes, Mark suggested something similar (but more sophisticated) which was rejected and I am wondering why.
>
> Herman's protocol is (roughly):
> - Values v: { value: v }
> - After last value: { done: true }
>
> With a sentinel value, this would look like:
> - Values v: v
> - After last value: SENTINEL_VALUE (defined once, somewhere)
>
> The latter seems simpler to me -- what's wrong with it?
>
> Thanks!
>
> Axel
>
> -- 
> Dr. Axel Rauschmayer
> axel at rauschma.de  <https://mail.mozilla.org/listinfo/es-discuss>
>
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130514/ad55b495/attachment.html>


More information about the es-discuss mailing list