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

What should the mangled names of anonymous functions and nested closures be? #54230

Open
d-netto opened this issue Apr 24, 2024 · 0 comments
Open
Labels
decision A decision on this change is needed lowering Syntax lowering (compiler front end, 2nd stage)

Comments

@d-netto
Copy link
Member

d-netto commented Apr 24, 2024

We have been working in #53719 on a new mangling scheme that will be helpful for reducing the number of precompile failures in our codebase (see PR's description).

For purposes of reducing name changes in the types of anonymous functions and nested closures across different versions of our codebase (i.e. an anonymous function whose type name is #3#4 in one version of the codebase and #5#6 in another slightly different version), we are making the counters used for generating these symbols private to every pair of (module, top-level function name), instead of keeping it per-module as it is.

The issue here is that the name of the enclosing top-level function appears twice if we have a nested lambda in it. See explanation for why this is the case and an example below:

julia> function foo(x)
           return y -> x + y
       end
foo (generic function with 1 method)

julia> f = foo(42)
#foo##0 (generic function with 1 method)

julia> typeof(f)
var"#foo##0#foo##1"{Int64}

@topolarity and @NHDaly didn't consider this duplication of #foo a merge blocker, but still, the names could be a bit nicer.

Opening this issue to track discussions/progress on the matter.

@d-netto d-netto added decision A decision on this change is needed lowering Syntax lowering (compiler front end, 2nd stage) labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
decision A decision on this change is needed lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
Development

No branches or pull requests

1 participant