[comp.lang.c++] Designing C++

pcg@cs.aber.ac.uk (Piercarlo Grandi) (07/05/90)

In article <11010@alice.UUCP> bs@alice.UUCP (Bjarne Stroustrup) writes:

   Piercarlo "Peter" Grandi writes:

    > I seem to understand that C++ is being developed with a "let's try this
    > feature" approach

   C++ wasn't developed that way.

Well, let's say that course corrections happen so often and in such
bizarre ways (just one example, please: the matter of 2.1 allowing
passing objects with constructors in ellipsis, but with bitwise copy!)
that one wonders whether at least in matters of detail things work out
that way.

On the other hand I do understand that there are some great and good
basic principles for the design of C++ (C compatibility, no need of
large runtime library, ability to stay close to the machine, etc...).

   These latter principles (constraints, rather) is what makes C++ usable
   outside the academic ghetto and outside the personal workstation sub-culture.

Cheers! Great! That is why I am using it. Now if only this applied to
compiler complexity as well (but you are already on record here as
regretting not having chosen a simpler grammar, at least) :-).

    > I was recently rereading Stroustrup's paper on MI in the Usenix journal.
    > He has an appendix rejecting one flavour of delegation, an extremely
    > elegant and C-ish technique, because users were confused by it. Instead
    > of thinking that maybe the proposed flavour of delegation was wrong, he
    > throws away delegation entirely,

   So I should dogmatically have kept it in despite it causing grief?

Well, the style of MI you have eventually adopted has caused enough
grief, let me say. It takes poor Lippman dozens of pages to explain the
very complicated rules concerning multiple prefixing.

   Or maybe I should have dropped everything else to figure out exactly
   why it was wrong and fixed it? The latter was certainly tempting -
   because I liked the notion of delegation and still do - and I tried
   unsuccessfully for a while. However, I suspect you underestimate the
   time and effort needed to get everything done.  I simply never found
   the time to explore delegation further.

I do not underestimate. You are working more or less at the frontiers of
the state of the art.

   Also, please read that note again. I most certainly suspected that it
   was the flavor of delegation tried  - rather than the general concept
   of delegation - that was wrong and I said so.

I did note that you found problems with *that* flavour of delegation...

   That design of delegation for C++ was an experiment that failed. I
   documented that. Would you have preferred me NOT to document the
   failure? That would not only have allowed people to keep their
   preconceived and untried notions (kept them happy) but also allowed
   me to wrap myself in a mantle of infallibility (there are no
   shortage of people that likes to do that - it keeps them admired and
   happy). To my mind that would have been fradulent, however, and
   would undoubtedly have led someone to repeat my mistakes.

Two minor points here: I agreee with your feelings... I know the
quandaries of language design, and I see you are in a pretty hot spot.
It's possible to say that it is easy for me from my armchair to
criticize, but that is always the case between artist and critic :-).

The second point is that documenting problems is the essence of
scientific communication, and after your paper we now know that at least
some people find at least pointer based delegation confusing. Why?
Because of unfamiliarity, inherent problems with delegation, or just
with that flavor? At least your appendix makes people think. That is a
good contribution.

My main point here is however not with the rejection of pointer based
delegation, but with the adoption of multiple prefixing, which I for one
find somewhat hasty -- even if there was incredible demand for it.

I, for one, reckon that it is fundamentally flawed on a matter of
principle, but most everybody else that has tried it has found multiple
prefixing, out of the simple cases, utterly confusing, and this is duly
reflected in the complexity of the rules and of the documentation
describing them.  The note on the failed pointer delegation experiment
is very interesting, but its summary dismissal of pointer based
delegation can be used, IMNHO, against multiple prefixing.


On a grander scale, let me repeat myself here: the open problems with OO
programming and SwEng are to find linguistic instruments for

	reuse of interface
	reuse of specification
	reuse of implementation

C++ suffers a bit from having a lack of design vision about these
issues, and maybe this is the root of the problems with multiple
prefixing versus pointer delegation, and all the other problems. I am
grateful enough that C++ however exists and works well enough, only
disappointed that it is not even better and more consistent.
--
Piercarlo "Peter" Grandi           | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth        | UUCP: ...!mcsun!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk