Focus

eles eles at eles.com
Mon Jan 21 04:49:46 PST 2013


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?


More information about the Digitalmars-d mailing list