public imports and template functions

Jonathan M Davis jmdavisProg at gmx.com
Wed Nov 24 01:11:43 PST 2010


On Wednesday 24 November 2010 00:18:44 Don wrote:
> Jonathan M Davis wrote:
> > Am I correct in my understanding that if you wish a template function
> > which is imported from another module to compile correctly without
> > requiring other imports in the module that your using the function in
> > that the module with the template function needs to publically import
> > all of the functions and types that it needs?
> 
> That's only true of mixins. (And for that reason, you should generally
> use fully qualified names in mixins).

That makes sense (and IMHO is much better behavior that what I was thinking the 
case was). I usually have so many imports which are common between files that it 
isn't an issue even with mixins, but it's a good idea to try and get rid of 
imports that you're not using, and in order to do that properly, you have to 
understand the import rules. I was afraid that some of my template stuff was 
working only because so many of the imports were common between files, but 
fortunately, that's not the case.  Thanks for the clarification.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list