PatternLanguage
PatternLanguage copied to clipboard
Namespace scope doesn't apply to variables
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;
}