Iteration protocol: a sentinel value?

Axel Rauschmayer axel at rauschma.de
Tue May 14 04:32:29 PDT 2013


Thanks! Can you elaborate?

On May 14, 2013, at 9:20 , André Bargull <andre.bargull at udo.edu> wrote:

> 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?

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

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/1a5e4556/attachment-0001.html>


More information about the es-discuss mailing list