Skip to content
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

Back-end: emit let instead of var. #6102

Merged
merged 1 commit into from
Apr 30, 2024
Merged

Back-end: emit let instead of var. #6102

merged 1 commit into from
Apr 30, 2024

Conversation

cristianoc
Copy link
Collaborator

@cristianoc cristianoc commented Mar 30, 2023

Fixes #856

  • Need to check that no cases are missed where this could introduce regressions even if the tests appear to be passing

  • This will generate a huge amount of noise in the diff w.r.t. other versions of the compiler. It might not be ideal to have this change in an initial version of compiler v11 if other changes are important as they would get lost in the noise

  • Note that the transformation creating problems in Fix issue with generating async functions inside loops. #6479 can be removed

@hhugo
Copy link
Contributor

hhugo commented Apr 3, 2023

You can then remove the previous fix (using IIFE) used to capture mutable variable

@cristianoc cristianoc modified the milestones: v11.0, v12 Apr 9, 2023
cristianoc added a commit that referenced this pull request Nov 9, 2023
The scope of `var` is per-function, requiring a transformation for closures inside loops when capturing loop variables.
This PR turns off the transformation.
This PR should go after #6102
@DZakh
Copy link
Contributor

DZakh commented Nov 9, 2023

I wonder how much it'll affect performance. But probably it won't be a big difference.

@fhammerschmidt
Copy link
Contributor

@DZakh did you see this: #856 (comment) ?

@DZakh
Copy link
Contributor

DZakh commented Nov 9, 2023

Wow, cool

cristianoc added a commit that referenced this pull request Nov 9, 2023
The scope of `var` is per-function, requiring a transformation for closures inside loops when capturing loop variables.
This PR turns off the transformation.
This PR should go after #6102
@cknitt
Copy link
Member

cknitt commented Apr 27, 2024

@cristianoc Could you rebase this? Now that 11.1 is out and development focus is shifting to v12, it would be great to get this merged.

@cristianoc cristianoc requested review from cknitt and removed request for cknitt April 28, 2024 11:00
Copy link
Member

@cknitt cknitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

Let's remove "Test" from the commit message and PR title before merging though.

CHANGELOG.md Outdated Show resolved Hide resolved
@cknitt
Copy link
Member

cknitt commented Apr 29, 2024

Sorry, I'm afraid you'll also need to rebase again.

@cristianoc cristianoc changed the title Test emitting let instead of var. Back-end: emitting let instead of var. Apr 30, 2024
@cristianoc cristianoc changed the title Back-end: emitting let instead of var. Back-end: emit let instead of var. Apr 30, 2024
@cristianoc
Copy link
Collaborator Author

@cknitt ready to go

Copy link
Member

@cknitt cknitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@cknitt cknitt merged commit 7bf97d9 into master Apr 30, 2024
14 checks passed
cristianoc added a commit that referenced this pull request Apr 30, 2024
The scope of `var` is per-function, requiring a transformation for closures inside loops when capturing loop variables.
This PR turns off the transformation.
This PR should go after #6102
cometkim pushed a commit to cometkim/rescript-compiler that referenced this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong compilation of closures
5 participants