[phobos] review for environment

Lars Tandle Kyllingstad lars at kyllingen.net
Thu Nov 4 05:42:59 PDT 2010


On Thu, 2010-11-04 at 08:37 -0400, Michel Fortin wrote:
> Le 2010-11-04 à 6:34, Jonathan M Davis a écrit :
> 
> > Regardless, I think that using a final, uninstantiatable class is the best way to create a namespace within a module in D at the moment.
> 
> It does pollute the object code with a useless vtable and ClassInfo object though. As long as there aren't too many of them it's probably fine.
> 
> Another way to achieve what you want would be:
> 
> 	template X() {
> 		void func();
> 	}
> 	mixin X x;
> 
> 	// now you can do
> 	x.func();


Unfortunately, that doesn't work with operator overloading, so it's out
of the question for environment.

-Lars



More information about the phobos mailing list