The new std.process is ready for review

Vladimir Panteleev vladimir at thecybershadow.net
Tue Mar 12 01:28:01 PDT 2013


On Tuesday, 12 March 2013 at 07:41:03 UTC, Lars T. Kyllingstad 
wrote:
> On Wednesday, 6 March 2013 at 07:27:19 UTC, Lars T. Kyllingstad 
> wrote:
>> On Tuesday, 5 March 2013 at 21:04:15 UTC, Vladimir Panteleev 
>> wrote:
>>> 5. How about that Environment.opIn_r?
>>
>> Forgot about it. :)  I'll add it.
>
> So I sat down to write this function, but then I reconsidered.  
> The thing is, checking whether the variable exists is exactly 
> the same operation as retrieving it.  In other words, this:
>
>    if (key in environment)
>    {
>        auto val = environment[key];
>        ...
>    }
>
> is equivalent to:
>
>    if (environment.get(key) !is null)
>    {
>        auto val = environment.get(key);
>        ...
>    }

Yes, it's just syntax sugar, and an operation supported by AAs 
(which environment imitates). It's useful if you don't want to 
retrieve the value of a variable right after checking if it 
exists - you just want to see if it's there or not.


More information about the Digitalmars-d mailing list