Flag proposal

Nick Sabalausky a at a.a
Fri Jun 10 22:10:58 PDT 2011


"Adam Ruppe" <destructionator at gmail.com> wrote in message 
news:isuhab$17hb$1 at digitalmars.com...
> Function local imports make it easier to reason about the code
> which is of slight importance. The big thing I'd like though is
> using it with mixins.
>
> In my cgi.d, there's a mixin main that depends on std.string being
> available inside the mixed in function.
>
> Currently, I use a public import of std.string. Alternatively, the
> other module could import it too, but that is pretty opaque.
>

I have need to do that sort of thing now and then, too. What I usually do is 
include it in my module as a public renamed import, renamed with some 
special prefix, like "_myModuleName_theOriginalName". Then I use that 
super-ugly name inside the code that's intended to be mixed in. It's an ugly 
hack, but at least it's semi-hygenic and works. Scoped imports would 
probably be far better.

>
> But a scoped import would be cleaner: I could ensure it's always
> available in that function without making the mixin user wonder
> WTF the error messages are about and without polluting his namespace.





More information about the Digitalmars-d mailing list