One of the "accessibility modifiers" (public, private, protected, internal, ...) may prefix an attribute, method, indexer, constructor, etc. in a class definition. This is to provide a means to help to preserving an object's integrity by limiting general accessibility.
Has anyone but myself desired a finer-grained control than this form propagated from objective-C, C++, Java, C# or Delphi? It presumes the designer to know _a priori_ what every client within a particular scope will require.
Modula-3 provides for partial revelations, and with the introduction of __partial__ classes in c# (that is, classes defined from within more than one source file), perhaps a similar construct could be added to c#. What could we call a class that is a partial revelation of elements of a defining class? I proposed the moniker __port__ for "partial object revelation", but that may be a misleading term, though it does suggest a "portion" of the defining class. --S. Lee Odegard
And how is the partial access modifier resolved; that is what's the mechanism by which the acess is partially revealed to the subclass? How is that done in Modula-3?
class FOO feature { ANY } -- roughly equivalent to public feature { NONE } -- roughly equivalent to private feature { FOO } -- roughly equivalent to protected, -- depending on how you define "protected" feature { BAR, BAZ } -- only available to the BAR and BAZ classes end[/code]
the "public" to "private" class accessibility modifiers has been my least favorite element of c++, java, and c#, since it forces every client to have the same view of the class. Consider that most "objects" in real live have multiple interaction experiences: for example an automobile has one for the driver, another for the passenger, and a third for the mechanic.
I have been experimenting with class presentations, which are alias types where only a named subset of the "public"ly accessible members of a class are available through the presentation. It is declared as an interface, only restating those elements in the class to be repackaged. This can be useful in determining the usage of a class in a scope for finding alternatives; This can be useful in enforcing access restraints.
One interesting question arised from this: why not just use interfaces? The presentation proposal is linked to exactly one specific class; an interface is a contract that can be fulfilled by any class. A presentation can instiantiate an instance of a class, since it is an alias (with some members hidden by not being named), which an interface cannot do. --Lee Odegard