On 03/12/2012 20:17, Rob T wrote:
On Monday, 3 December 2012 at 14:22:28 UTC, Nick Treleaven wrote:

Most programmers would probably just pollute the existing scope:

auto x = "thing" in arr;
if (x && *x == 45)
{
    ...
}


You can always wrap it inside its own scope

Yes, that's why I wrote:

> I expect this is because wrapping the above in {} for a new scope is
> just too ugly, introducing more nesting and indentation.

;-)

>    // temp scope
>    {
>      auto x = "thing" in arr;
>      if (x && *x == 45)
>      {
>         ...
>      }
>    }

I would much prefer this:

with (auto x = "thing" in arr)
if (x && *x == 45)
{
    ...
}

Reply via email to