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

[Bug][move-compiler-v2] Move language <= 2.1 has separate function and variable namespaces #15404

Open
brmataptos opened this issue Nov 26, 2024 · 0 comments
Labels
bug Something isn't working compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale

Comments

@brmataptos
Copy link
Contributor

🐛 Bug

This is related to #15360, but different. It's a well-defined semantics, but probably not what we want in a language with function values.

The Move language (through Move 2.1) has separate name spaces for function names and variables.

Consider the following program:

module 0x42::Test {

    public fun f(a: u64, b: u64): u64 {
        a * b
    }

    public fun test_shadowing(): u64 {
        let f = 7;
        f(3, 4) + f
    }
}

Note that there is both a local variable f and visible function f in the body of test_shadowing(). In the function call position preceding (...), the name f refers to the function. In other expressions, f refers to the local variable.

The historic distinction between "Lisp 2" and "Lisp 1" isn't seeming so strange all of a sudden.

@brmataptos brmataptos added the bug Something isn't working label Nov 26, 2024
@vineethk vineethk added the stale-exempt Prevents issues from being automatically marked and closed as stale label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler-v2 stale-exempt Prevents issues from being automatically marked and closed as stale
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants