tc39 / proposal-joint-iteration

a TC39 proposal to synchronise the advancement of multiple iterators
https://tc39.es/proposal-joint-iteration
70 stars 2 forks source link

IteratorCloseAll should be in reverse order #8

Closed bakkot closed 10 months ago

bakkot commented 10 months ago

There's a TODO asking this question, so here's the answer: resources should be closed in LIFO order, as if you'd nested try-finally blocks. See also the dispose method of the DisposableStack, which does disposing "in reverse list order".