On Thu, Jun 9, 2022, at 1:36 PM, Michał Marcin Brzuchalski wrote: > Hi Larry, > > czw., 9 cze 2022 o 18:34 Larry Garfield <la...@garfieldtech.com> napisał(a): > >> Last year, Nuno Maduro and I put together an RFC for combining the >> multi-line capabilities of long-closures with the auto-capture compactness >> of short-closures. That RFC didn't fully go to completion due to concerns >> over the performance impact, which Nuno and I didn't have bandwidth to >> resolve. >> >> Arnaud Le Blanc has now picked up the flag with an improved implementation >> that includes benchmarks showing an effectively net-zero performance >> impact, aka, good news as it avoids over-capturing. >> >> The RFC has therefore been overhauled accordingly and is now ready for >> consideration. >> >> https://wiki.php.net/rfc/auto-capture-closure > > > Nice work. Well-described behaviors. > > One question, more around future scope or related functionality in the > future: > A future RFC for "short-methods" described here in one of your declined RFC > https://wiki.php.net/rfc/short-functions in the past could be revived with > no conflicts in the scope of methods? > > class Foo { > public string $firstName = 'John'; > public function getFirstName(): string => $this->firstName; > } > > I'm asking if I understand the scopes of this and previous RFCs correctly > and if they don't block in future "short-methods"? > > Cheers, > Michał Marcin Brzuchalski
The short-functions RFC is entirely separate. The syntax choices in both that RFC and this one were made to ensure that they don't conflict with each other, and the resulting syntax meaning is consistent across the language. The implementations are independent and should in no way conflict. (The short-functions RFC would have enabled short-methods too. It was purely a syntax sugar with no additional behavior.) That's assuming the attitude toward the short-function RFC ever changes enough in the future to make it worth trying again... --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php