Re: [RFC][Vote] Auto-capture closures

From: Date: Sat, 02 Jul 2022 09:18:15 +0000
Subject: Re: [RFC][Vote] Auto-capture closures
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-118160@lists.php.net to get a copy of this message
>But do any of them auto-capture by value? in c++ it's optional if you want to capture-by-value or capture-by-reference, [&]()->void{...}(); captures everything by reference and [=]()mutable->void{...}(); captures everything by value > I think that's still explicit fair assessment On Sat, 2 Jul 2022 at 05:02, Anton Smirnov <sandfox@sandfox.me> wrote: > On Fri, 2022-07-01 at 16:11 +0200, Hans Henrik Bergan wrote: > > > As far as we are aware, only two languages in widespread use > > > require variables to be explicitly closed over: PHP and C++. All > > > other major languages capture implicitly, as is proposed here. > > But do any of them auto-capture by value? > > > to be fair to c++, it supports [&] to capture everything, like > > int a=1,b=2,c=3;[&]()->void{std::cout << a << b << c;}(); > > I think that's still explicit > > -- > Anton >

« previous php.internals (#118160) next »