The new std.process is ready for review

Vladimir Panteleev vladimir at thecybershadow.net
Tue Mar 12 02:13:59 PDT 2013


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 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)".


More information about the Digitalmars-d mailing list