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

Namespace scope doesn't apply to variables #140

Open
BobSmun opened this issue Nov 30, 2024 · 0 comments
Open

Namespace scope doesn't apply to variables #140

BobSmun opened this issue Nov 30, 2024 · 0 comments

Comments

@BobSmun
Copy link
Contributor

BobSmun commented Nov 30, 2024

When a variable is defined inside a namespace, the namespace scope needs to be dropped to be able to access the variable

namespace test {
    bool something = true;
    bool setting in;
}

//way to access
something = false;
setting = true;

//expected way to access
test::something = false;
test::setting = true;

It also means that it is impossible to use namespaces to separate different instances of variables. In the below example, all three instances of 'something' collide with each other

bool something = true;

namespace test {
    bool something = true;
}

namespace test2 {
    bool something = true;
}
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