[phobos] review for environment
Lars Tandle Kyllingstad
lars at kyllingen.net
Wed Nov 3 05:02:33 PDT 2010
Sorry for not responding to this myself earlier, but I was on vacation
with limited internet access.
I did try adding ranges, but quickly saw the issues Steve mentions.
There are probably ways of working around them, but it won't improve
performance, and I feel it's complete overkill for such a simple thing.
What I would like to get some feedback on is the way I've simulated a
singleton object by using an abstract final class as a namespace for the
various functions. To my knowledge, this has no precedent in Phobos.
It does feel a bit weird, but it seemed like the simplest solution.
Also, would it be OK to mark getenv(), setenv(), and unsetenv() as
deprecated, now that environment has been present in two releases?
(Note that setenv() and unsetenv() are POSIX-only.)
-Lars
On Thu, 2010-10-28 at 13:28 -0500, Andrei Alexandrescu wrote:
> Thanks for the response.
>
> Andrei
>
> On 10/27/10 22:05 CDT, Steve Schveighoffer wrote:
> >
> >
> >
> >
> > ----- Original Message ----
> >> From: Andrei Alexandrescu<andrei at erdani.com>
> >>
> >> Yah, I was referring to opAA.
> >
> > With Posix, you have environment variables stored in a __gshared global.
> > Providing a local range on that data isn't a good idea. Windows provides the
> > function GetEnvironmentStrings, which returns a memory block allocated to hold
> > all the environment variables. You must call FreeEnvironmentStrings to free the
> > memory.
> >
> > These are the only ways to iterate variables. If you want individual variables
> > for which you already know the names, there are functions for that, but Lars'
> > code implements those through individual functions, not toAA.
> >
> > The only way I could see it done better is to have a type that allows setting of
> > the variables when you assign to the AA. But you still need to copy the data.
> >
> > -Steve
> >
> >
> >
> >
> > _______________________________________________
> > phobos mailing list
> > phobos at puremagic.com
> > http://lists.puremagic.com/mailman/listinfo/phobos
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
More information about the phobos
mailing list