Topic: Addition: Per-function "friend-like" access


Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/05/21
Raw View
In article ebu@steel.interlog.com, herbs@interlog.com (Herb Sutter) writes:
>
>It would be very useful to be able to specify which clients are allowed to
>access which methods.  For example, I would like language support for saying
>something like: "Class A [and derivatives] can invoke Class X's methods
>X::MethodOne and X::MethodTwo, Class B [&deriv] can invoke Class X's method
>X::MethodSeven, and no one else can access anything in X."  Has this been
>considered by the committee in the past?

Not every "would be useful" feature can be incorporated into the language.
Each suggestion has to be evaluated on the basis of its perceived cost
and benefits. Individuals may differ in their evaluations, of course. See
D&E for more on this subject.

This particular feature was never considered valuable enough, by enough
people, to incorporate. My copy of D&E isn't handy right now, and I
don't know whether it discusses this particular issue.

---
Steve Clamage, stephen.clamage@eng.sun.com