Skip to content

feat: emit const instead of let for immutable assignment#1059

Merged
anmonteiro merged 4 commits intomainfrom
anmonteiro/const
Feb 13, 2024
Merged

feat: emit const instead of let for immutable assignment#1059
anmonteiro merged 4 commits intomainfrom
anmonteiro/const

Conversation

@anmonteiro
Copy link
Copy Markdown
Member

In #1019, we're taking advantage of the fact that let is lexically scoped, much alike OCaml's let. It allows us to remove some loop-captured variable closures in #1020 and preserve the same guarantees syntactically.

This change goes even further, by emitting const in the generated JS for values that we know to be immutable assignment.

@anmonteiro anmonteiro marked this pull request as ready for review February 13, 2024 19:36
@anmonteiro
Copy link
Copy Markdown
Member Author

Going to go ahead and merge this to test in some other projects. It's easy to revert a single commit anyway.

@anmonteiro anmonteiro merged commit 4f2bd0c into main Feb 13, 2024
@anmonteiro anmonteiro deleted the anmonteiro/const branch February 13, 2024 20:21
@anmonteiro anmonteiro mentioned this pull request Apr 5, 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.

1 participant