constancy and template parameters in D2.009+

Christopher Wright dhasenan at gmail.com
Fri Dec 14 05:56:07 PST 2007


Janice Caron wrote:
> Maybe D2.007 got it right after all. Maybe multiple instantiations is
> really not such a bad thing. Walter did suggest (in relation to a
> different query) that the linker could be improved so that identical
> functions are elided into a single function. If he could do that,
> you'd get bigger .obj files, but the .exe would still be small.
> Ultimately, that's probably the right way to go, so maybe we should
> forget these intermediate kludges?

That does seem best. It could also combine other identical methods -- 
not a bad thing.

> You're certainly right about the fact that RemoveHeadConst! would be a
> furiously hard template to write though. (But Andrei could probably do
> it!)

I'm not saying that it'd be furiously hard. I'm saying it may be 
impossible to get something that works in the general case for structs. 
It's not obvious that a mapping for a const struct T(U, V, W, ...) would 
go to a struct T(const(U), const(V), const(W), ...). It may well be the 
case, but I'm uncertain.

And even if that works, it does nothing for struct members that aren't 
associated with template parameters.

So an expressive system would have keywords for 'tail-const' and 'this 
member is not const if this data type is tail-const'.



More information about the Digitalmars-d mailing list