Function-local imports
Jesse Phillips
jessekphillips+D at gmail.com
Tue Apr 27 10:04:52 PDT 2010
retard Wrote:
> >
> > Can't you just use 'with'?
> >
> > static import std.math;
> >
> > // Code...
> >
> > int foo(int x) {
> > with(std.math) {
> > return cast(int)(sqrt(cast(real)x) * 2);
> > }
> > }
> >
> > Or was there another issue trying to be solved?
>
> The other thing is to disable the visibility of the symbol outside the
> with scope. There are languages that have succesfully unified these two
> constructs. D isn't one of them.
I guess I don't understand why that is of value.
More information about the Digitalmars-d
mailing list