Path: utzoo!mnetor!uunet!husc6!mailrus!ames!oliveb!pyramid!prls!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: comp.lang.c++ Subject: C++ enhancements Message-ID: <2781@mmintl.UUCP> Date: 19 Mar 88 22:51:04 GMT Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Ashton-Tate Corporation, East Hartford Development Center Lines: 41 Following are some suggestions for improvements to C++. Add a new keyword "leaf" to the language. This is applied to a (virtual) function declaration to indicate that the function is not redefined in any subclass of the current class. This enables the translator to generate a direct call to the function for objects known to be in the current class. I know that the same thing can be accomplished by prefixing class-name:: to the call, but I want the facility attached to the declaration, not the call. As an extension, one could apply the leaf modifier to a class defintion, which makes it illegal to define an subclasses of the class. This in effect makes any functions defined for the class leaf functions. Why not let the result of applying the & operator to a reference variable be an lvalue? This would mean one could write something like: int & a = i; int j; (&a) = &j; If the original declaration was "int & const a = i", the assignment would be illegal. (Note the parentheses around "&a". Permitting them to be dropped would require a syntax change. This would be better, but I'm not sure off hand how difficult it would be.) Has anything been done yet about the ambiguity of prefix and postfix operators when overloading "++" and "--"? How about "operator postfix ++" and "operator postfix --", with the unadorned forms being prefix? It seems like it would be easy to define an alternative form for the "for" statement: for { statement expression-opt ; compound-statement } statement This permits generalized update statements as well as generalized initialization. (It will mean that "break" statements must, in general, be translated into "goto"s.) There has been some discussion recently in comp.lang.c about permitting aggregate expressions in more general contexts. Has this been considered for C++? If so, what is its status? -- Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Ashton-Tate 52 Oakland Ave North E. Hartford, CT 06108