@IluTov Unsolicited opinion, but imo anything other than the obvious default should be explicit, so we would need some way to indicate auto-capture: $c = function() use (..., &$matches) { ... }
@MarkR The message is referring to externals.io/message/121022#121055, which proposes using blocks as a global solution including arrow functions. So yes, I would agree that by-ref capturing should remain explicit.
That seems like a good idea, but I still think another keyword will be required.
If you add the keyword you can re-use-use (heh) and end up with $x = iife use (&$x) { ... } or treat everything after ( as an explicit capture list e.g. $x = iffe (&$x) { ... } but I might be wayyyy off on what Levi is thinking
@MarkR Levi suggested allowing blocks in all closures with the proposed capturing mechanism, not just immediately executing ones. Limiting this mechanism to iifes would be too restrictive, given that one could not even combine them with arrow functions (fn () => iife use (&$x) {}), given that &$x needs to be captured by-ref in the outer scope (relative to the arrow function). It's also incredibly hard to read.
@MarkR You suggested a different keyword. I might've been missing your point.
Levi suggested adding blocks to the language globally, so that we have blocks for arrow functions automatically. He suggested then extending them with auto-by-ref-capturing using the & syntax. This avoids the need for special fn() {} syntax.
@IluTov Ah, yeah if blocks were to become generic things which could be used in the form $x = { ... } as the rust docs linked in that post mentioned, we would likely need something to switch the tokenizer into a mode to accept auto-capture overrides.