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

Inconsistent requirement for scope resolution qualification of functions vs custom types #85

Open
paxcut opened this issue Mar 30, 2024 · 0 comments

Comments

@paxcut
Copy link
Contributor

paxcut commented Mar 30, 2024

A user-defined type declared inside a namespace can be used inside the namespace without full qualification (aka explicit full scope resolution in name) but functions seem to require the use of their full names regardless of location of usage.

Consider the following declarations:

namespace ns {
    struct S {
        u8 c = 3;
    };

    fn fun(auto arg) {
        return arg+1;
    };
}

Using them the following code runs correctly:

import std.io as io;
namespace ns {

    S s;
    io::print("{}",ns::fun(s.c));
}

but dropping the full name from fun causes an error indicating that the function could not be found as shown in the next image. Either both S and fun should need their full name or neither should.

image

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

No branches or pull requests

1 participant