Q: Hiding template implementation

Myron Alexander someone at somewhere.com
Tue Jun 12 13:41:38 PDT 2007


Kirk McDonald wrote:
> You can't. Templates don't compile to anything on their own. Object code 
> for them is only generated when the template is instantiated. In order 
> to instantiate a template, the code using the template needs full access 
> to the template's source.
> 
> D's templates are very much like C++'s templates in this respect. The 
> following is somewhat relevant:
> http://www.parashift.com/c++-faq-lite/templates.html#faq-35.12
> (Though note it is about C++ and not D, so many of the specifics are 
> different.)
> 

I was hoping there was some clever option I was missing :) I eventually 
realized that the current implementation does not do what I believe 
would be a major boon for library writers and users so I started a 
thread on d.D about creating a new form of binary module.

P.S. What do you think of the changes to D-DBAPI, along the lines of 
what you wanted?

Regards,

Myron.


More information about the Digitalmars-d-learn mailing list