Skip to content

Conversation

dmlloyd
Copy link
Member

@dmlloyd dmlloyd commented Apr 7, 2025

The existing tests already cover capturing and non-capturing cases. Also fixes a bug where a relational- or compare-to-zero-if statement at the end of a block is still considered to possibly fall through even if none of its branches fall through.

Fixes #266

The existing tests already cover capturing and non-capturing cases.
Also fixes a bug where a relational- or compare-to-zero-if statement at the end of a block is still considered to possibly fall through even if none of its branches fall through.

Fixes quarkusio#266
@dmlloyd dmlloyd added the 2.x Issue applies to Gizmo 2.x label Apr 7, 2025
@dmlloyd dmlloyd moved this to In Progress in WG - Gizmo 2 Apr 7, 2025
Copy link
Contributor

@Ladicek Ladicek left a comment

Choose a reason for hiding this comment

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

I probably don't understand how the word "singleton" is used here, but this is about evaluating the lambda once and returning a MH to the result, instead of creating a MH that evaluates the lambda on each call?

@dmlloyd
Copy link
Member Author

dmlloyd commented Apr 8, 2025

It's about the lambda instance - the object which implements the functional interface. If there are captures, we must construct a new instance each time with the captured values. If not, we can return the same instance each time.

@dmlloyd dmlloyd merged commit af4e99e into quarkusio:main Apr 8, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in WG - Gizmo 2 Apr 8, 2025
@dmlloyd dmlloyd deleted the lambda-singletons branch April 8, 2025 11:43
@Ladicek
Copy link
Contributor

Ladicek commented Apr 8, 2025

Ah, yes, makes sense. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issue applies to Gizmo 2.x
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Gizmo2: Non-capturing lambdas should be singletons
2 participants