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

From: Date: Sat, 02 Jul 2022 12:23:40 +0000
Subject: Re: [RFC][Vote] Auto-capture closures
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-118161@lists.php.net to get a copy of this message
On 01/07/2022 15:04, Larry Garfield wrote:
Greetings, Internalians. The vote for auto-capture closures is now open. It will run until 15 July. https://wiki.php.net/rfc/auto-capture-closure
I have voted No, because although I am more-or-less convinced that auto-capture is a useful feature, I don't think this is the right syntax for it. - Having "fn" and "function" mean almost the same thing, but with such an important difference, feels like a WTF waiting to happen. - The RFC seems to take for granted that shorter syntax is better, calling explicit syntax "noise"; but in that case PHP contains a lot of "noise", and I'm not convinced that removing it would be a good thing. - This emphasis also implies that auto-capture is a near-universal improvement over explicit capture, rather than an alternative on equal footing: it is the version that deserves the very best syntax possible. I remain unconvinced by this. - Unlike other languages, PHP normally relies on opting into scope imports (global, $this->, etc), so lacks a mechanism to opt out and declare a variable as local (var, let, etc). The proposed syntax offers neither opt-in nor opt-out, relying on the implementation to do the right thing automatically ... most of the time. To re-iterate, I am not opposed to the feature in principle, but would have loved to see a more open exploration of different syntax options. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#118161) next »