-
Notifications
You must be signed in to change notification settings - Fork 469
Add Iterator.prototype bindings #7506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
rescript
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/darwin-x64
@rescript/win32-x64
commit: |
external toArrayWithMapper: (t<'a>, 'a => 'b) => array<'b> = "Array.from" | ||
|
||
let forEach = (iterator, f) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm for this change 👍
Iterator.forEach
's behaviour was different to Iterator.prototype.forEach
as the latter only calls its callback with yielded values, not the iterator's final return value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff, thanks a lot!
But could you use tests (using assertEqual
) instead of doing Console.log
s in the doc strings?
package.json
Outdated
@@ -86,6 +86,7 @@ | |||
"@types/node": "^20.14.9", | |||
"@types/semver": "^7.7.0", | |||
"@yarnpkg/types": "^4.0.1", | |||
"es-iterator-helpers": "1.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should move to Node 22 for dev instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure how straightforward it is to use one Node version for x and another for y. I'm curious to hear what @cometkim thinks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant increase it from 20 to 22 in .nvmrc. This would then be picked up by CI, and by your node version manager when working in local dev.
The minimum version in package.json can remain 20 as that's still supported for another year.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. How can we ensure that we don't use any newer Node features in our CLI scripts? That happened some time ago.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could run the test-integration step of the CI build with the oldest supported node version. (Not sure if that would catch everything though, it should also try rescript format
then for example.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that could work.
Yep, will do! I'm less familiar with that part of the codebase. |
@@ -1,5 +1,9 @@ | |||
include Core_IntlTests | |||
|
|||
%%raw(` | |||
import 'es-iterator-helpers/auto'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be removed now (should work without it in Node 22).
@@ -478,7 +478,7 @@ jobs: | |||
- name: Use Node.js | |||
uses: actions/setup-node@v4 | |||
with: | |||
node-version-file: .nvmrc | |||
node-version: 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a comment here:
node-version: 20 | |
# Run integration tests with the oldest supported node version. | |
node-version: 20 |
This may be a bit controversial, but I've added bindings for Iterators and Generators and corrected some bindings, resulting in a minor breaking change.