Implicit instantiation of parameterless templates
F i L
witte2008 at gmail.com
Fri Oct 5 12:41:02 PDT 2012
Dmitry Olshansky wrote:
> Hm... If placed at the global scope it looks like a namespace.
I don't see anything wrong with that. It's just another way
(somewhat unique to D) you can categorize your code. Most people
probably won't use this sort of thing all over the place, but it
actually might be useful for "enforcing" naming classifications:
// File system/io.d
template Console
{
void write( ... )
void read()
}
template File
{
void write( ... )
void read()
}
// File something.d
import system.io;
void main()
{
// Prefix 'Console/File' required so to the
// user, it looks somewhat like a static object
Console.write( ... );
File.write( ... );
}
More information about the Digitalmars-d
mailing list