Access modifier for extensions

Boyd gaboonviper at gmx.net
Thu Jan 16 09:45:39 PST 2014


On Thursday, 16 January 2014 at 11:18:07 UTC, Gary Willoughby 
wrote:
> This can be achieved with traditional OOP design patterns and i 
> have to agree with the above poster this is too much like C++ 
> hacking and looks horrible.

I think I misrepresented my case by mucking up the example. I 
don't care about any individual use case. Ignore it. What I'm 
looking for is a way to represent this:

class AThing
{
     public void DoSomethingAnyoneCanDo();
     public_ish void DoSomethingThatRequiresExpertise();
}

The first method in the class, is something you want to expose to 
any user. The second is meant for the guy who wants access to the 
more advanced stuff, where you have to know what you are doing. 
Inheriting from the class is not an option, or at least unwanted.

Basically I need the 'package' attribute, but for modules outside 
the package, even modules I have no control over, or know 
anything about.

Am I really the only who ever found the need for such a thing? 
Because I see situations where this could be pretty damn handy, 
all the time.


More information about the Digitalmars-d mailing list