On 17 February 2016 at 09:40, Benjamin Gruenbaum <benjami...@gmail.com>
wrote:

> If you starve a generator it's not going to get completed, just like other
>> control flow won't.
>>
>
> I'm not sure starving is what I'd use here - I definitely do see users do
> a pattern similar to:
>
> ```js
> function getResults*() {
>      try {
>          var resource = acquire();
>          for(const item of resource) yield process(item);
>      } finally {
>          release(resource);
>      }
> }
> ```
>

Yes, exactly the kind of pattern I was referring to as "bogus forms of
resource management". This is an anti-pattern in ES6. It won't work
correctly. We should never have given the illusion that it does.


garbage collection is a form of automatic resource management.


Most GC experts would strongly disagree, if by resource you mean anything
else but memory.

/Andreas
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to