fix error with function evaluating arguments in the wrong order#5276
Draft
giacomocavalieri wants to merge 1 commit intogleam-lang:mainfrom
Draft
fix error with function evaluating arguments in the wrong order#5276giacomocavalieri wants to merge 1 commit intogleam-lang:mainfrom
giacomocavalieri wants to merge 1 commit intogleam-lang:mainfrom
Conversation
f402e61 to
f0e78c8
Compare
lpil
reviewed
Jan 16, 2026
Member
lpil
left a comment
There was a problem hiding this comment.
Thank you! Couple notes inline 🙏
Looking at this now, would it not make sense to expand calls with labels to a series of statements prior to codegen? This would mean not needing to duplicate the code across both target code generators, and we wouldn't need to add another special case to collapse blocks in codegen.
| Arg = 'fun'(<<"evaluated first"/utf8>>), | ||
| Arg@1 = 'fun'(<<"evaluated second"/utf8>>), | ||
| wibble(Arg@1, Arg) | ||
| end. |
Member
There was a problem hiding this comment.
Can we remove these redundant blocks? 🙏
| export function main() { | ||
| (() => { let arg = fun("evaluated first"); | ||
| let arg$1 = fun("evaluated second"); | ||
| return wibble(arg$1, arg); })(); |
Member
There was a problem hiding this comment.
Can we remove these redundant IIFEs? They have a performance cost.
For any that we are to keep, can we fix the formatting please 🙏
Member
Author
|
Oh I haven't thought of it that's a great idea! I'll change the implementation |
Member
|
Sweet, thank you! |
f0e78c8 to
fac1523
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR closes #5272
I'm not so sure about the JS solution, what do you think?