On Wed, Mar 15, 2023 at 1:09 AM Rowan Tommins <rowan.coll...@gmail.com> wrote:
> On 14/03/2023 22:54, Larry Garfield wrote: > > Well, a large part of my resistance to automatic capture is that it > makes variable scope less visible at a glance. This avoids that by still > having a marker for "I am from another scope", but a much less verbose > one than the current use() clause. > How about first implementing use() for anonymous classes first? Something like: function foo(int $outer) { return new class() use($outer) { public function getIt() { return $outer; } }; } This would help with the main problem you expressed and be a less concern for the future. It's a different direction from what you suggested but it might be a lot harder to pass a $^ syntax or similar. Regards, Alex