You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Creating a sequence from an iterable, step 3.4. is Initialize Si to the result of converting nextItem to an IDL value of type T. This step can throw. That isn’t addressed with either ? (ReturnIfAbrupt shorthand) or express handling. I’m not sure if that omission is an error itself or if Web IDL allows for implicit abrupt-completion-bubbling.
If conversion throws, I’d expect IteratorClose to get called. The absence of iterator closing in the conversion algorithm can be observed when, for example, finally blocks don’t get evaluated:
document.createElement('canvas').getContext('2d').setLineDash(function*(){try{yieldSymbol();// will fail to coerce to unrestricted double, throwing a TypeError}finally{console.log('iterator closed');// return() isn’t called; this statement isn’t evaluated}}());
When the above is evaluated in Chrome or Firefox, the iterator isn’t closed. Safari however does perform iterator closing if member conversion fails — the finally block does get evaluated. Although that’s a departure from the Web IDL spec currently, I think that should be the specified behavior.
The Array.from builtin may be instructive because in the usingIterator path, if you ignore the bits that are specific to assembling an ES array, it’s pretty much the same premise as create-a-sequence-from-an-iterable (where mapFn is the Web IDL “convert” step which might throw).
The text was updated successfully, but these errors were encountered:
In Creating a sequence from an iterable, step 3.4. is
Initialize Si to the result of converting nextItem to an IDL value of type T.
This step can throw. That isn’t addressed with either?
(ReturnIfAbrupt
shorthand) or express handling. I’m not sure if that omission is an error itself or if Web IDL allows for implicit abrupt-completion-bubbling.If conversion throws, I’d expect IteratorClose to get called. The absence of iterator closing in the conversion algorithm can be observed when, for example,
finally
blocks don’t get evaluated:When the above is evaluated in Chrome or Firefox, the iterator isn’t closed. Safari however does perform iterator closing if member conversion fails — the finally block does get evaluated. Although that’s a departure from the Web IDL spec currently, I think that should be the specified behavior.
The Array.from builtin may be instructive because in the
usingIterator
path, if you ignore the bits that are specific to assembling an ES array, it’s pretty much the same premise as create-a-sequence-from-an-iterable (wheremapFn
is the Web IDL “convert” step which might throw).The text was updated successfully, but these errors were encountered: