<div dir="ltr">Is there a way to achieve this:<div><br></div><div>----</div><div>module foo;</div><div><br></div><div>{<br></div><div>import bar;</div><div><div>void fun1(){bar.barfun();}</div></div><div><div>void fun2(bar.BarType a){}</div>
</div><div>}</div><div><br></div><div>// now bar is not in scope anymore.</div><div>void fun3(){}</div><div><div>----</div></div><div><br></div><div>This would reduce name clashes conflicts, ease refactorings and in general make code a bit cleaner. </div>
<div><br></div><div>Related question:</div><div><br></div><div>Why isn't the following allowed:</div><div>----</div><div>void fun(){</div><div>// code without version=A</div><div>  version=A;<br></div><div>// code with version=A</div>
<div>  vesion(none):</div><div>//code versioned out</div><div>}<br></div><div><div>----</div></div><div>I understand the grammar doesn't allow it, but what's the rationale, and can it be fixed?</div></div>