Re: [RFC] Draft - Closure self reference

From: Date: Wed, 11 Nov 2020 19:16:12 +0000
Subject: Re: [RFC] Draft - Closure self reference
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-112228@lists.php.net to get a copy of this message
Hi everyone, maybe a bad idea, but what about addressing the "Principle of least astonishment" issue by allowing to specify/capture the variable after the function is assigned: $f = function () use ($f) {...}; With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, Michael Voříšek On 10 Nov 2020 18:08, Dan Ackroyd wrote:
Hello internals, For reasons, I was reviewing the conversation where adding closures to PHP was added, and it reminded me that currently the only way for a closure to call itself is slightly terribly, so I drafted an RFC: https://wiki.php.net/rfc/closure_self_reference Before I spend time on it, is there any strong reason why this is a bad idea? cheers Dan Ack


« previous php.internals (#112228) next »