Guilherme Souza (2015-04-05T16:42:56.000Z)
There is no "correct" way, it depends on the consumer logic.

The for-of construction, for instance, ignores the value when {done: true}.
While `x = yield* y` delegation store the returned value in `x`.

See related discussion:
https://esdiscuss.org/topic/proposal-generator-returning-a-value-should-throw-syntaxerror

On Sun, Apr 5, 2015 at 10:04 AM, Mark Volkmann <r.mark.volkmann at gmail.com>
wrote:

> I thought that when an iterator returns done: true, the value should not
> be used. However, if a generator function ends by returning a value, done
> will be true when that value is returned and the value should be used.
> Given this, how can a consumer know the correct way to handle the value
> when done is true? Clearly consumers shouldn't have to be aware of whether
> the iterator is actually a generator and whether it ends by returning a
> value.
>
> ---
> R. Mark Volkmann
> Object Computing, Inc.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
Graduando em Engenharia de Controle e Automação


*Universidade Estadual de Campinas*
http://sitegui.com.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150405/e7930a10/attachment.html>
d at domenic.me (2015-04-14T22:23:40.271Z)
There is no "correct" way, it depends on the consumer logic.

The for-of construction, for instance, ignores the value when {done: true}.
While `x = yield* y` delegation store the returned value in `x`.

See related discussion:
https://esdiscuss.org/topic/proposal-generator-returning-a-value-should-throw-syntaxerror