scoped imports

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sun Aug 18 19:36:37 PDT 2013


On Monday, 19 August 2013 at 01:16:44 UTC, Timothee Cour wrote:
> goal1: avoid polluting global module name space:
> void fun(){
> version=A;
> //now the code below in fun() scope has version(A) set
> }
>
> goal2:
> void fun(){
> version(none):
> //all the code below this IN THIS FUNCTION becomes versioned out
> //(avoids requiring extra {} scope
> }

I honestly think that you are spending far too much mental effort 
in pursuit of complex, finnicky solutions for issues that can be 
dealt with much better by other means.

If you're getting namespace clashes because one set of functions 
is dependent on foo.stuff and others are dependent on bar.stuff, 
surely the simplest way to avoid it is to place them in different 
modules -- which can then be grouped into a package if needed. 
What's wrong with this approach?


More information about the Digitalmars-d-learn mailing list