scoped imports

Timothee Cour thelastmammoth at gmail.com
Sat Aug 17 15:29:56 PDT 2013


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.
void fun3(){}
----

This would reduce name clashes conflicts, ease refactorings and in general
make code a bit cleaner.

Related question:

Why isn't the following allowed:
----
void fun(){
// code without version=A
  version=A;
// code with version=A
  vesion(none):
//code versioned out
}
----
I understand the grammar doesn't allow it, but what's the rationale, and
can it be fixed?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130817/3166f719/attachment.html>


More information about the Digitalmars-d-learn mailing list