Package functions cannot be abstract?!

Neia Neutuladh neia at ikeran.org
Wed Jan 30 17:21:31 UTC 2019


On Wed, 30 Jan 2019 12:28:42 +0000, Benjamin Schaaf wrote:
> On Wednesday, 30 January 2019 at 04:05:15 UTC, Jonathan Levi wrote:
>> Do you have a recommendation on how to do what I am trying to do?
> 
> So you want a public class that has private abstract methods that you
> share across private implementations. Why not use an interface?

The reason you use package instead of protected is to expose the function 
to be called by other functions in different modules in the same package.

It feels to me like D took some design cues here from Java and C++ without 
accounting for differences between D's `private` and Java's, then rolled 
those decisions forward into `package`. Virtual dispatch and protection 
should be orthogonal except insofar as the compiler can use protection to 
prove that there are no overrides of a function.


More information about the Digitalmars-d mailing list