Thread View: comp.std.c++
1 messages
1 total messages
Started by Jean-Frangois Brouillet
Tue, 31 Oct 1995 16:21
YABOK (Yet Another Bunch Of Keywords)
Author: 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. ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads