Article View: comp.std.c++
Article #2374YABOK (Yet Another Bunch Of Keywords)
From: Jean-Frangois Brouillet
Date: Tue, 31 Oct 1995 16:21
Date: Tue, 31 Oct 1995 16:21
71 lines
3185 bytes
3185 bytes
As the use of C++ grows, so does the availability of numerous class
libraries. Some keywords are required to help, even the skilled and mature
C++ programmer who has to deal with hundreds of classes (to wit. 100+
classes in PowerPlant framework + 50+ classes in NeoAcess framework = 150+
opportunities to get lost in deep inheritance hierarchies, not even
speaking about STL or the upcomming C++ standard library...)
consider
class K : public J {
...
void f(void);
virtual void g(void);
};
f can be:
1) a new non-virtual method not previously existing in the hierarchy
2) an override of an f method, somewhere within the ancestry of K
similarly, g can be:
1) a new virtual method not previously existing in the hierarchy
2) an override of a g method, somewhere within the ancestry of K
Similarly, some keywords are over(ab-?) used (virtual as above, static)
while some concepts lack a much needed support.
So, while, ideally, I would prefer language support for the following
keywords, a set of macros within a header file would do it. The goal is to
standardize on a documentation practice, and I beleive that providing a
header file, rather than language support will postpone flamewars. (At
least I hope so...)
File sugar.
#define override virtual
#define regular /* nothing */
#define shared static
#define owned /* nothing */
given these definitions, the class K above could be rewritten:
#include <sugar>
class K : public J {
...
regular void f(void); // f is new to K, *and* NOT virtual
override void g(void); // g is virtual, overriden from some base J or
// deeper
};
class L : public K {
...
shared void p(void); // p is a *class* method: no 'this' pointer,
// p is thus shared among all instances
shared short ic; // ic is a *class* member data, shared by
// all instances
owned char st; // st is an *object* member data, each instance
// has its own copy
};
Of course, nothing prevents *me* from using these macros, but their
widespread use would help all the C++ community in dealing with more
readable and thus maintainable source files; at least this so I feel.
Any comments ?
Jean-Franรงois Brouillet
Macintosh Software Developer
verec@micronet.fr (preferred)
verecundus@eworld.com
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<475iek$291@engnews1.eng.sun.com>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: verec@micronet.fr (Jean-Fran\gois Brouillet) Newsgroups: comp.std.c++ Subject: YABOK (Yet Another Bunch Of Keywords) Date: 31 Oct 1995 16:21:40 GMT Organization: ? Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <475iek$291@engnews1.eng.sun.com> NNTP-Posting-Host: taumet.eng.sun.com Content-Type: text Content-Length: 2461 X-Lines: 67 Originator: clamage@taumet