Sara Golemon wrote: > looks a bit... ugly? weird? surprising? I had the same initial reaction, and was going to tell David what I thought of the suggestion. But after a couple of days, I was unable to actually articulate what I didn't like it, so think I was just having a gut reaction to something I hadn't seen before, and so wasn't used to seeing.
Sara Golemon wrote: > That's a lot of... stuff Yeah, but it's a really rare use-case for a closure to need to be able to reference itself, so I think it's probably fine to have some verbosity around "this closure is doing something quite unusual". I personally think any of: function (... $args) as $lambda: returnType use ($captures...) {} function (... $args): returnType as $lambda use ($captures...) {} function (... $args): returnType use ($captures...) as $lambda {} would be fine and various 'my aesthetic choice is objectively the best' arguments, could be made for any of them. David Rodrigues wrote: > I ended up preferring this last option. I prefer the others as I think they are more deliberate syntax (i.e. don't look like a typo), avoid confusion around why can't normal functions be declared with leading $'s, and almost certainly would be easier to search for what they are. e.g. "php closure as variable" cheers Dan Ack -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php