The new std.process is ready for review

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Mar 12 20:56:34 PDT 2013


On Wed, Mar 13, 2013 at 04:27:21AM +0100, Vladimir Panteleev wrote:
> On Tuesday, 12 March 2013 at 21:39:47 UTC, Steven Schveighoffer
> wrote:
> >>I'd be very interested to hear if you have a suggestion for a
> >>better way to do it, keeping in mind that there needs to be
> >>*some* way to clear the environment too.
> >
> >Sadly, no I don't.  I had hoped [] would allocate an empty AA, but
> >it fails to compile.
> >
> >Note that you can "hack" it by setting a single environment
> >variable which nobody will ever use.
> >
> >i.e. spawnProcess("blah.exe", ["_____":"_____"]);
> >
> >But that is really, really ugly.
> 
> How about this:
> 
> @property string[string] emptyEnvironment()
> {
>     string[string] result;
>     result["a"] = "a";
>     result.remove("a");
>     assert(result && result.length == 0);
>     return result;
> }
> 
> (can be cached to avoid allocating each time)

I like this idea.


T

-- 
It won't be covered in the book. The source code has to be useful for
something, after all. -- Larry Wall


More information about the Digitalmars-d mailing list