The new std.process is ready for review

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Mar 12 07:17:34 PDT 2013


12-Mar-2013 18:09, Steven Schveighoffer пишет:
> On Tue, 12 Mar 2013 05:13:59 -0400, Vladimir Panteleev
> <vladimir at thecybershadow.net> wrote:
>
>> On Tuesday, 12 March 2013 at 08:58:13 UTC, Lars T. Kyllingstad wrote:
>>> For AAs, 'in' returns a pointer to the element, which is null if the
>>> element does not exist.  I can't think of a good way to implement
>>> this.  Since we have to convert the raw environment variable to a D
>>> string anyways, we'd have to do something like:
>>>
>>>   string* opIn_r(string var)
>>>   {
>>>       auto val = get(var);
>>>       if (val is null) return null;
>>>       else return [val].ptr;
>>>   }
>>>
>>> but that seems rather pointless to me.
>>
>> Yes. That use of the "is" operator is mainly to allow updating the value
>
> you meant "in", not "is", right?
>
>> without looking up the key twice. This behavior could be implemented
>> using a proxy object, but this is not what I was talking about. I
>> meant the specific case of "if (key in environment)".
>
> I think Valdimir wants to have opIn_r return bool?
>

What's wrong with adding an actual AA (inside) as a write-through cache 
for environment variables?


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list