Eigenpoll : D wish list : Explicit module `friendship` 

Currently, if two or more classes are in the same module, they automatically become "friends" (as in C++ friends) and all the "private" stuff becomes meaningless inside that module.

Now, this "friend" concept is considered a hack and an indication of bad design by most OO programmers.

Since D's philosophy is not forbidding "bad stuff", but being explicit about it, I propose that "module frienship" become optional, and turned off by default. To turn it on, a special keyword must be used, and it must be placed right after the module declaration, or even inside the module declaration.

for example:

module file_name;
friends; //explicitly turn module friendship "on"


or

friendly module file_name;


or something like that ...

Report this item for cleanup