archives

« Bugzilla Issues Index

#1973 — 25.4.3.9: IteratorStep should use IteratorComplete


IteratorStep 25.4.3.9, step 4 should be replaced with a call to IteratorComplete. The ToBoolean call in step 6 can then be removed. Justification: Using IteratorNext to retrieve the iteration result, but not using IteratorComplete to check the iteration status looks inconsequent. And IteratorComplete provides better separation of concerns than the manual Get().


The reason IteratorComplete wasn't used is because IteratorStep inverts the meaning of the Boolean result, relative to IteratorComplete.

You might argue that this is confusing, but it seemed to be more natural in the places where IteratorStep is used.


The `Get(result, "done")` and `ToBoolean(done)` parts in IteratorStep() are exactly the same in IteratorComplete(). Specifically I was thinking of the following change.

From:
---
4. Let done be the result of Get(result, "done").
5. ReturnIfAbrupt(done).
6. If ToBoolean(done) is true, then return false.
7. Return result.
---

To:
---
4. Let done be the result of IteratorComplete(result).
5. ReturnIfAbrupt(done).
6. If done is true, then return false.
7. Return result.
---


ok

fixed in rev20 editor's draft


fixed in rev20 draft, Oct. 28, 2013