Meta:
Would the package access specifier work for this, as long as
you keep it in the same package?
It's the opposite problem, I'd like to detect where I am using
private names by mistake, and the compiler doesn't complain
because it's in the same module.
I've seen Jacob Carlborg suggest that unittests should be put
in a separate module before, maybe this is an argument for
that, even in smaller projects.
Putting the unittests very close to their functions/methods is
very good, for various reasons. I even sometimes write functions
like this:
void foo() {
...
} unittest {
...
}
I think this would be confusing for people coming from Java,
C#, and C++ as well,
People coming from Java/C# are able to learn it well, but newbies
that don't know about private attributes will have troubles,
because to learn something new you usually prefer/need a strict
teacher (or strict compiler).
Programmers would have to consider yet another access specifier
when adding struct/class variables. It seems like unnecessary
mental overhead for something that can be avoided fairly easily.
In the main D newsgroup some people were recently discussing
about a new access specifier, to be used by reference data
"owned" by a class/struct :-)
Bye,
bearophile