Re: [RFC] Draft - Closure self reference

From: Date: Tue, 10 Nov 2020 17:38:38 +0000
Subject: Re: [RFC] Draft - Closure self reference
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-112218@lists.php.net to get a copy of this message
something i'm missing from Javascript is the ability to give names to closures, this both gives closures the ability to reference themselves, but it also makes for meaningful stack traces, eg this is legal javascript: (function TheClosuresLocalName(){console.log(TheClosuresLocalName); throw new Error("look at my stacktrace!");})(); - the name is optional, and only visible inside the closure itself, and unfortunately this is not legal in PHP, i wish it was.

« previous php.internals (#112218) next »