From: raymond@es.ele.tue.nl (Raymond Nijssen)
Newsgroups: comp.lang.c++
Subject: Re: The concept of templates considered ill designed
Date: 29 Sep 92 11:25:02 GMT
	<1992Sep28.200820.592@sunb10.cs.uiuc.edu>
Organization: Eindhoven University of Technology, Eindhoven, The Netherlands
In-reply-to: pjl@sparc22.cs.uiuc.edu's message of 28 Sep 92 20:08:20 GMT

I wrote:
[..]
>>This, and other observations lead to the conclusion that templates are to be
>>regarded as almost old-fashioned macros, in contrast to what the ARM made me
>>believe (or should I say `hope'?).

In the 2nd edition of "The C++ programming language", BS makes a statement
about how the programmer should deal with the complications for the compiler
introduced by the concept of templates:

         "It is the implementation's job - _not_ the programmer's - to
         ensure that versions of template functions are generated for 
         each argument type to the template." (p. 258)

(The underscores indicate that the enclosed word is printed in italics).

And, on p. 259, BS says:

         "When a function definition is needed for ar class template
         member function for a particular type, it's the implementation's 
         job to find the template for the member function and generate 
         the appropriate version."
But:
         "An implementation may require the programmer to help find 
         templates unless some convention is obeyed."

Note that the language definition doesn't say how to help find and 
it's not clear what or what kind of convention is meant.


In article <1992Sep28.200820.592@sunb10.cs.uiuc.edu> pjl@sparc22.cs.uiuc.edu (Paul Lucas) writes:

>*****>	It's implementation-dependent.  For example, in AT&T's C++, you
>   	don't include the .c files, you just tell it where they are via
>   	the usual -I directive...it does the rest.

Your conclusion is definately right. It reinforces my fear that the language
definition leaves too much room.

>       The only difference
>   	is that you put the .c files into the include directory right
>   	along with the .h files...hardly a change in coding style or
>   	anything else.

This is for AT&T's C++. Other implementations are allowed to do this differently
in a way which is not transparent to the programmer.

IMHO, I call the apparent vagueness of the last sentence quoted an
example of an ill definition, which may easily lead to confusion which 
in turn will lead to bad portability of C++ programs in which templates
are used.

>   	I'd suggest a more inquisitive tone, rather than accusatory in
>   	future.

?? Please don't take my expression of disappointment (because of the
implementation dependency) as an accusation, on the contrary: I'm 
still hoping for a statement proving my more or less provocative
statement in the subject line wrong. Who else can do so better than
BS himself?

Regards,
-Raymond
--
| Raymond Nijssen         | Eindhoven University of Techology                 |
|                         | Department of Electrical Engineering              |
| raymond@es.ele.tue.nl   | Design Automation Section (ES),  Room EH 7.16     |
| phone: +31-40-473373    | P.O. Box 513, 5600 MB Eindhoven, The Netherlands  |
| fax:   +31-40-464527    |  "Jan Timmer for President of The Netherlands!"   |