Are templates required ?

Anders F Björklund afb at algonet.se
Fri Jan 19 06:03:22 PST 2007


Frits van Bommel wrote:

>> Are templates an optional feature of D 1.0,
>> or are they required by any implementation ?
>> 
> I'd say it's required to be fully compliant to the spec. However, I 
> don't think it's necessarily sufficient reason to deny the other 
> benefits of D to users of an old toolchain.

Which spec is that ? I don't recall them failing any tests.

For me it would be cool to just have a version(D_Templates),
but that doesn't work if/when crucial parts of D uses them.

> How does g++ fix this, by the way? C++ has templates, so it should be 
> possible. Or does that also fail for 'more complex programs'?

Apple's GCC 3.3 supports C, C++ and Objective-C. But not D...
(and GDC doesn't build with Apple GCC 3.3, only with GCC 4.0)

I believe that in the Dark Ages, templates used to fail all
over the place, but that C++ compilers eventually caught up ?

> And in what way would "private" template emission fail, anyway? It might 
> cause extra bloat but I can't see how it would fail?

DMDscript doesn't work because it throws exceptions at start:
"Error: circular initialization dependency with module script"

readf/TypeInfo doesn't work, because it uses "is" to compare.
(and since it emits multiple instances, that doesn't work OK)

> Something else about the original problem: Would it maybe be possible to 
> backport once-only linkage to the old GCC? Or would that be a lot of work?

It's a lot of work, and I haven't been able to complete it yet.
(there is also very little demand for such a thing, it seems...)

I think David has deprecated GCC 3.3 for GDC in general, as well.
And DMD doesn't have any support for Mac, just Windows and linux.

--anders



More information about the Digitalmars-d mailing list