| Bradd W. Szonye 2004-11-04, 3:58 pm |
| Antoun Kanawati wrote:
> You can't get by without a header file, period. Or, to avoid the
> double negative: you absolutely need the source to compile, and it
> doesn't matter if that source lives in another "module". Everything
> in the header file needs to be compiled, and possibly "executed"; but,
> some things, like templates, take more compiler effort than others
> (plain old primitive C++ declarations).
That was exactly my point. C++ templates take a /lot/ more compiler
effort than simple declarations do. They pose roughly the same problem
as Scheme macros. While the latter have some additional complications,
the compiler effort is the main obstacle to separate compilation.
> The header file language has no restrictions, and it is only by
> convention that it is usually restricted to declarative constructs.
>
> In the C/C++ world that seems to be an acceptable limitation of
> separate compilation ....
It doesn't work for templates, though, just as it doesn't work for
Scheme macros.
> Of course, trying to define a strictly declarative subset of Scheme
> is somewhat more difficult ....
That's a vast understatement! It's the key issue both for Scheme macros
and C++ templates.
--
Bradd W. Szonye
http://www.szonye.com/bradd
|