thanks. That's a bit clunky though, so it's unlikely to be used. Not sure what it would take to make the grammar allow it.
On Sat, Aug 17, 2013 at 4:23 PM, bearophile <bearophileh...@lycos.com>wrote: > Timothee Cour: > > > Is there a way to achieve this: >> >> ---- >> module foo; >> >> { >> import bar; >> void fun1(){bar.barfun();} >> void fun2(bar.BarType a){} >> } >> >> // now bar is not in scope anymore. >> > > Using a struct as namespace: > > > struct Foo { > import std.stdio; > static void bar(int x) { x.writeln; } > } > alias bar = Foo.bar; > > void main() { > bar(10); > // writeln(20); // std.stdio out of scope > } > > > Bye, > bearophile >