Why do generator expressions return generators?

David Bruant bruant.d at gmail.com
Fri Sep 6 09:14:28 PDT 2013


Le 06/09/2013 18:06, Brendan Eich a écrit :
>> Domenic Denicola <mailto:domenic at domenicdenicola.com>
>> September 6, 2013 8:48 AM
>> What is the value of allowing you to send in values via `.next(v)`, 
>> or send in exceptions via `.throw(e)`?
>
> An iterator does not reject .next calls that pass a value.
fair enough (sorry about my earlier message on .next. It's part of the 
iterator interface, not sure why I wrote that)

> As for .throw, don't do that unless you want what you get. "Doctor, it 
> hurts when I ...."
Why exposing something that's meant to be a footgun? Just don't expose it?

David


More information about the es-discuss mailing list