From 6910685961382097778
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,109af18a94b8a35c
X-Google-Attributes: gid109fba,public
X-Google-Thread: f78e5,e5cae9ffbf1dd57e,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-10-02 14:29:06 PST
Xref: sparky comp.lang.c++:14452 comp.std.c++:1285
Newsgroups: comp.lang.c++,comp.std.c++
Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
Subject: Re: The concept of templates considered ill designed
Message-ID: <1992Oct2.153826.12051@ucc.su.OZ.AU>
Sender: news@ucc.su.OZ.AU
Nntp-Posting-Host: extro.ucc.su.oz.au
Organization: MAXTAL P/L C/- University Computing Centre, Sydney
References: <RAYMOND.92Sep29122502@cobra.es.ele.tue.nl> <1992Oct1.140643.9775@cadsun.corp.mot.com>
Date: Fri, 2 Oct 1992 15:38:26 GMT
Lines: 56

In article <1992Oct1.140643.9775@cadsun.corp.mot.com> shang@corp.mot.com writes:
>
>Thank you, Raymond, for raising this thread. I'd like to fork it
>to comp.std.c++ for standard committee to reconsider whether template should be  
>accepted as C++ standard.

	How would you modify the template idea to be better?

>
>In article <stefans.717754437@bauv106> stefans@bauv106.bauv.unibw-muenchen.de  
>(Stefan Schwarz) writes:
>
>> Would be interesting to hear from library-developers about shipping their
>> products together with source-code.
>
>Right to the point. Would be interesting also to hear about from the  
>library-users about reading the source code to detect where are the source of  
>the usage error.
>
>Template is not a self-enclosed type-safe language feature, i.e. it cannot be  
>compiled separately to ensure type-error free. All type errors about the class  
>parameters are checked when the template is used. When the library-developers  
>ship their products, they cannot ensure their templates are type-error free.  

	This is not true, of course they can. What you mean
is that the compiler doesn't help very much, and I agree.
But I'm sure one could prove that a template was error free
by hand ( I agree this is not formal system like a compiler check,
but lets not get into whether a proof actually proves what it purports
to or not: the usual solution to this problem is to publish the
proof ).

>The library user will get confused when an error is reported on the source code  
>of the template: "should it be my fault or the fault of the template itself?"
>
>In sense of the relationship between developer and user, template is something  
>like untyped function (I don't refer to run-time type error).
>
>David Shang

	I agree but am too stupid to see how the situation could be
improved. For a template class C, it will be the case that

	C<T1>  makes sense
	C<T2>  is illegal

depending on T1 and T2. One cant check that until use, unless
perhaps you have to predeclare:

	class C<T1>; // causes expansion NOW!

-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------


