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

Backport: nested function name canonicalization #179

Open
wants to merge 1 commit into
base: v1.10.2+RAI
Choose a base branch
from

Commits on Oct 26, 2024

  1. Canonicalize names of nested functions by keeping a more fine grained…

    … counter -- per (module, method name) pair (JuliaLang#53719)
    
    As mentioned in JuliaLang#53716, we've
    been noticing that `precompile` statements lists from one version of our
    codebase often don't apply cleanly in a slightly different version.
    
    That's because a lot of nested and anonymous function names have a
    global numeric suffix which is incremented every time a new name is
    generated, and these numeric suffixes are not very stable across
    codebase changes.
    
    To solve this, this PR makes the numeric suffixes a bit more fine
    grained: every pair of (module, top-level/outermost function name) will
    have its own counter, which should make nested function names a bit more
    stable across different versions.
    
    This PR applies @JeffBezanson's idea of making the symbol name changes
    directly in `current-julia-module-counter`.
    
    Here is an example:
    
    ```Julia
    julia> function foo(x)
               function bar(y)
                   return x + y
               end
           end
    foo (generic function with 1 method)
    
    julia> f = foo(42)
    (::var"#bar#foo##0"{Int64}) (generic function with 1 method)
    ```
    d-netto authored and kpamnany committed Oct 26, 2024
    Configuration menu
    Copy the full SHA
    35513b3 View commit details
    Browse the repository at this point in the history