From: matt@physics16.berkeley.edu (Matt Austern)
Newsgroups: comp.lang.c++,comp.std.c++
Subject: The fate of my exponentiation operator proposal
Date: 12 Nov 92 23:42:42
Organization: Lawrence Berkeley Laboratory (Theoretical Physics Group)
Reply-To: matt@physics.berkeley.edu
NNTP-Posting-Host: physics16.berkeley.edu

A while ago, as some of you probably remember, I posted a proposal
(X3J16/92-0127 and WG21/N0204) for adding an exponentiation operator
to C++.

The extensions working group has considered this proposal and rejected
it.  A number of people on the Net have talked about the idea of an
exponentiation operator, so I thought they might be interested in
hearing the reasons for this decision.

(Oh, since this is the Net, and words here are even more subject to
misinterpretation than they usually are, I just want to make this
clear: I am not attacking anyone, I am not accusing anyone of
anything, and I am not trying to start an argument.  I really am just
posting this for the reason I gave above: I thought that some people
might want to know this, and might not learn it through other
channels.)

The following is an excerpt from the analysis of my proposal, which
was written by Dag Bruck (dag@control.lth.se).  Actually, this is
pretty much the entirety of the analysis, including the comments that
I made in response to it.  That's the easiest way to make sure I don't
take anything out of context!

------------------------------------------------------------

The proposal was rejected for the following reasons:

1.  People who do not write numerical programs will probably find a
C++ exponentiation operator neither beneficial nor detrimental,
according to the proposal.  However, every user of C++ must learn this
new feature.

2.  An operator provides syntactic convenience, but does not provide
any new functionality.  Members of the working group, representing
heavy users of scientific/engineering computation, indicated that the
operator syntax provides minor syntactic convenience.

3.  Users have stressed the importance of substituting their own
specialized power functions for the system default, which would not be
possible with an intrinsic operator.

4.  The proposal is not well motivated; in particular, by analyzing
one 30.000 line FORTRAN program, it does not show that the operator
would be widely used.

5.  The propsal requires adding a new operator and adding another
precedence level, thus increasing the complexity of the language.

Consequently, the working group did not consider that the advantages
of the proposal outweigh the disadvantages.

The working group does however favour the suggestion to overload
function pow() to take an integer exponent, which would become part of
the standard C++ library.

Matthew Austern, the author of the proposal, comments the rejection as
follows.  Some detailed comments on the causes of rejection have been
omitted.

"I am glad to see that the working group supports adding operator
pow(double, int) to the standard library.  Even without an
exponentiation operator, this change will be a real benefit, and will
rectify a noticeable omission.  As I said in my original proposal,
this change will remove all arguments in favor of an exponentiation
operator except for the syntactic argument.

I believe, however, that it is a mistake to dismiss the importance of
syntax so readily.  Syntax matters!  Syntax is the reason why C++
(unlike, for example, Objective C) supports operator overloading; for
that matter, syntax is the only reason why C++ (again, unlike, for
example, lisp) has operators at all.  On a smaller scale, syntax is
the reason why the language was extended to permit overloading of both
operator++() and operator++(int).

Users of most other languages have found the syntactic convenience of
an exponentiation operator to be useful, and I see no reason why C++
would be an exception.

I am sorry to see this proposal rejected because I still believe that,
of the currently popular languages, C++ is probably the best suited
for the type of scientific programs that I write.  The absence of an
exponentiation operator, however, will make it harder for me to
persuade my colleagues to that point of view."

--
Matthew Austern                   Just keep yelling until you attract a
(510) 644-2618                    crowd, then a constituency, a movement, a
austern@lbl.bitnet                faction, an army!  If you don't have any
matt@physics.berkeley.edu         solutions, become a part of the problem!
Newsgroups: comp.lang.c++