home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:16047 comp.std.c++:1528
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: PROPOSAL: Hidden private parts of classes
- Message-ID: <1992Nov10.191740.2438@taumet.com>
- Organization: TauMetric Corporation
- References: <1992Oct30.113234.15010@daimi.aau.dk> <1992Nov7.154137.21910@ucc.su.OZ.AU> <1992Nov9.032225.10320@taumet.com> <1992Nov10.071110.6177@jyu.fi>
- Date: Tue, 10 Nov 1992 19:17:40 GMT
- Lines: 46
-
- sakkinen@jyu.fi (Markku Sakkinen) writes:
-
- >In article <1992Nov9.032225.10320@taumet.com> steve@taumet.com (Steve Clamage) writes:
- >>If you mean private non-virtual member functions which don't appear in
- >>the class definition, it would cause another language change.
- >>Overloading is resolved before accessibility is checked. Suppose we have:
- >> ... Overloading
- >>is resolved first precisely to avoid quiet semantic changes based only
- >>on access rights.
-
- >In my opinion, it was a bad choice in the first place to resolve
- >overloading before accessibility, although the argument presented in the ARM
- >makes partial sense. However, that argument does not apply at all
- >to this new suggestion: since such helper functions were to be declared
- >outside the class definitions, they cannot be made accessible to derived
- >classes or outside cliennt just by changing access rights.
-
- I neglected to carry my discussion to the next logical step.
-
- The class could have different semantics depending on which declarations
- were visible in which compilation units. This is just what is being
- asked for, but IMHO you should not want this facility; it is a
- recipe for subtle bugs.
-
- At the time you set up the class and provided some hidden functions
- you had some reason for wanting to do so. Maybe you even documented
- it in a comment somewhere. What about the next programmer doing
- maintenance (which could be you 6 months later)? Just what are the
- slippery semantics of the class supposed to be?
-
- Clients using the class expect precisely the visible semantics. Some
- impelemtation details depend on bent semantics. When some of these
- details need to be modified, which version of bent semantics should
- be used? What if the maintainer doesn't notice extra functions which
- affect overloading but which are not visible in the class definition
- and documentation?
-
- Some languages (Modula, Ada) provide for completely hidden
- implementation details. This is a nice feature overall, but is
- controlled in these languages. I don't believe such languages
- allow completely free and ad-hoc declarations, and it seems to
- me that is what is being proposed here.
- --
-
- Steve Clamage, TauMetric Corp, steve@taumet.com
- Vice Chair, ANSI C++ Committee, X3J16
-