On Monday, 21 January 2013 at 12:49:47 UTC, eles wrote:
On Friday, 18 January 2013 at 22:29:45 UTC, Walter Bright wrote:
On 1/18/2013 2:16 PM, Andrey wrote:

This is by design, not a bug. All code in a module has access to all private members in that same module. This obviates the need for the C++ "friend" declarations.

Yes, but that is a bad choice. The simplest argument against it it is that it is a departure of C++. Yes, you've made "private" like Java (package), but that's not the first intended audience.

If you cannot go back with private acting like C++ private, then at least introduce an "internal" specifier for things that truly belongs to the class only (ie: the C++ private).

You could have:

internal
private
package
protected
public
export

or

private
semiprivate // well? better ideas?
package
protected
public
export

Why make access protection dependent of how the source code is spread into files?

What would be the point ? You'll have the implementation and the function definition under the nose anyway as it is in the same file.

If something should be private from your code, what is your code doing is the same module ?

Reply via email to