Skip to content

Make static lambdas static#318

Merged
slozier merged 1 commit intoIronLanguages:mainfrom
BCSharp:static_lambda
Mar 27, 2026
Merged

Make static lambdas static#318
slozier merged 1 commit intoIronLanguages:mainfrom
BCSharp:static_lambda

Conversation

@BCSharp
Copy link
Copy Markdown
Member

@BCSharp BCSharp commented Mar 27, 2026

A smart compiler should see that there is no need to generate a closure and avoids doing it. Nevertheless, it is best to be explicit about it and avoid the closure for sure. This PR does exactly that.

I am not aware about CA or IDE rules checking it. Rules to make static methods static are already enabled.

Copy link
Copy Markdown
Contributor

@slozier slozier left a comment

Choose a reason for hiding this comment

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

Thanks! Didn't even know that static lambdas were a thing! 😄

@slozier slozier merged commit a7ab6fa into IronLanguages:main Mar 27, 2026
8 checks passed
@BCSharp BCSharp deleted the static_lambda branch March 27, 2026 16:12
@BCSharp
Copy link
Copy Markdown
Member Author

BCSharp commented Mar 27, 2026

Thanks! Didn't even know that static lambdas were a thing! 😄

Static lambdas are a thing since C# 9 (.NET 5). They were not around when the DLR was written.

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.

2 participants