Why is protected not also implicit package?

Frank Benoit keinfarbton at googlemail.com
Tue Aug 26 17:16:14 PDT 2008


While porting Java code this is kind of annoying.
In Java a protected member is also accessbible from the package.
And I think this would also make sense for D.

What i end up doing is often this pattern:

// existing method
protected int meth( double a, Object b ){
  //...
}
// added from me
package int meth_package( double a, Object b ){
  return meth( a, b );
}

Then replace all reference from within the package with meth_package.
This works, but is so ugly.

Or how about allowing the combination of protected and package like this?
protected package int meth( double a, Object b ){
  //...
}



More information about the Digitalmars-d mailing list