lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Feb 12, 2013 at 1:08 PM, Javier Guerra Giraldez
<javier@guerrag.com> wrote:
> On Tue, Feb 12, 2013 at 3:06 PM, Peter Slížik <peter.slizik@gmail.com> wrote:
>> I already wanted to argue that C++ implements proper local scoping without
>> having a 'local' keyword. ;-)
>
> c++ proper local scoping???
>
> i know that C++11 has a lot of goodness i haven't tried but i think
> "proper local scoping" doesn't sound possible on that syntax.
>
> the new lamda expressions are a _huge_ step forward, but having to
> specify which (and how) variables are captured to create a closure
> doesn't count as lexical scoping... much less to call it "proper"
>
>
> --
> Javier
>

C++ has lexical scoping.

{
  int x = 1;
  {
    int x = 3;
    std::cout << x << std::endl;
  }
  std::cout << x << std::endl;
}

The fact that its lambdas aren't closures is irrelevant to that.

/s/ Adam