This PR satisfies the rest of #26. It uses more specific callback types for the following operators:
map()
flatMap()
forEach()
In particular, it uses the unsigned long long WebIDL type to represent the "index" of the item being passed into the corresponding callback, since it is the largest integer type that WebIDL is. At first I was worried about that, because that type has a max value of 264 - 1, which is strictly larger than ECMAScript's "Number" type, which appears to be used for the same "index" argument in the Iterator helpers (see map()) and AsyncIterator helpers (see map()). Specifically, ECMAScript calls 𝔽(counter) for each index that gets incremented, which maps the index to a Number, which is just a double (and smaller than an unsigned long long).
Fortunately, when WebIDL converts an unsigned long long to an ECMAScript value, it does so in the exact same way that ECMAScript does (by choosing the closest ECMAScript "Number" value to the given value as possible, choosing the even even significand one when necessary).
This PR satisfies the rest of #26. It uses more specific callback types for the following operators:
map()
flatMap()
forEach()
In particular, it uses the unsigned long long WebIDL type to represent the "index" of the item being passed into the corresponding callback, since it is the largest integer type that WebIDL is. At first I was worried about that, because that type has a max value of 264 - 1, which is strictly larger than ECMAScript's "Number" type, which appears to be used for the same "index" argument in the Iterator helpers (see
map()
) and AsyncIterator helpers (seemap()
). Specifically, ECMAScript calls 𝔽(counter) for each index that gets incremented, which maps the index to a Number, which is just a double (and smaller than an unsigned long long).Fortunately, when WebIDL converts an unsigned long long to an ECMAScript value, it does so in the exact same way that ECMAScript does (by choosing the closest ECMAScript "Number" value to the given value as possible, choosing the even even significand one when necessary).