On Sunday, December 23, 2012 22:12:17 Phil Lavoie wrote: > > private is _always_ module scope. > > Ooops I meant private functions inside a module. I was wondering > if that would be allowed: > > module a; > public auto aFunc( T )( T t ) { cantSeeMe( t ); } > private auto canSeeMe( SomeType t ) { ... } > > module b; > import a; > alias a.canSeeMe canSeeMe > public auto canSeeMe( SomeOtherType t ) { ... } //Can this be > called by afunc?
No. cantSeeMe is looked up in aFunc's scope, which means that it sees a.cantSeeMe, not b.canSeeMe, so it'll call a.cantSeeMe. If b.cantSeeMe were called, it would be a compiler bug. Templates do symbol look up in their original scope, not in the scope that they're instantiated. They only do symbol lookup in the scope that they're instantiated in if they're mixed in, which you're obviously not doing here. - Jonathan M Davis