From -7165891974056025068
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,aef96954609d602c
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1993-08-16 10:36:55 PST
Newsgroups: comp.std.c++
Path: gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!netcomsv!netcom.com!rfg
From: rfg@netcom.com (Ronald F. Guilmette)
Subject: Re: Template constraints
Message-ID: <rfgCBv3Ly.Kq5@netcom.com>
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
References: <rfgCB638z.2t3@netcom.com> <rfgCBAw1F.7Hx@netcom.com> <1993Aug16.004133.23916@mole-end.matawan.nj.us>
Date: Mon, 16 Aug 1993 17:08:22 GMT
Lines: 42

In article <1993Aug16.004133.23916@mole-end.matawan.nj.us> mat@mole-end.matawan.nj.us writes:
>In article <rfgCBAw1F.7Hx@netcom.com>, rfg@netcom.com (Ronald F. Guilmette) writes:
>
>> Regarding the problem of syntax checking of templates...
> ...
>> (It is a fairly well known fact that it is often hard, if not impossible to
>> produce link-time diagnostics which point the user back to the original
>> source file and original source line which is really causing the problem.
>> Therefore, if given the choice, I would always opt for a language design
>> which makes it possible to generate a maximal number of the required
>> diagnostics at compile-time rather than putting everything off until link-
>> time.)
>
>Ron, I hope you'll forgive me if I tread this ground again; I know we've
>done it elsewhere.
>
>The `compile-then-link' model assumes that all semantic analysis (and code
>generation) can be performed before any name resolution (or relocation).
>Templates break this assumption, since semantic analysis must be deferred
>until the template is specialized, and the template can't be specialized
>until the entire program is present (because specialization depends on what
>has been written `manually').
>
>Thus the notions of `compile time' and `link time' get rather badly blurred.

While I would agree that templates do indeed have such a "blurring" effect,
they most certainly DO NOT (and cannot) eliminate the important distinction
between "compile-time" and "link-time" as far as the C++ standard is concerned.
There will ALWAYS be errors which MUST be diagnosed at "compile-time", and,
similarly, there will always be certain kinds of errors which MUST be
diagnosed at "link-time".

To the extent that diagnostics for template-related (erroneous) usage is
NOT explicitly mandated to occur at one or the other of these two times,
the specification (in the C++ standard) of the templates feature is incom-
plete.

-- 

-- Ronald F. Guilmette ------------------------------------------------------
------ domain address: rfg@netcom.com ---------------------------------------
------ uucp address: ...!uunet!netcom.com!rfg -------------------------------


