Re: [RFC] Short Closures 2, aka auto-capture take 3
| From: | Rowan Tommins | Date: | Tue, 14 Jun 2022 16:04:06 +0000 |
| Subject: | Re: [RFC] Short Closures 2, aka auto-capture take 3 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117946@lists.php.net to get a copy of this message | ||
(Sorry for double reply, hit send too soon)
On 14/06/2022 12:18, Arnaud Le Blanc wrote:
Your example uses isset(), which is valid code in most circumstances, but as you said it's not particularly good code. Do you have other examples that come to mind ?There is plenty of code out there in the real world that is not particularly good, so I think it's a realistic example to think about. The question is, do we think the language can and should help people avoid that mistake? - Would the explicitness of "use(...)" make it more likely someone would spot it? - Would people be more likely to write "let $guest=..." (or whatever block-scope keyword we choose) than add "$guest = null;" at the beginning of the closure? I'm not totally sure, but we should always consider the impact on less-expert users, not just the power-users who are the ones often asking for new features. Regards, -- Rowan Tommins [IMSoP]