Re: [PHP-DEV] Expression code blocks

2023-06-22 Thread Andreas Hennings
Hello Ilija, On Sat, 17 Jun 2023 at 13:27, Ilija Tovilo wrote: > > Hi Andreas > > On Fri, Jun 16, 2023 at 9:23 PM Andreas Hennings wrote: > > > > Hello list, > > I don't know if something like this was already proposed in the past, > > I did not find anything. > > > > Sometimes it would be nice

Re: [PHP-DEV] Expression code blocks

2023-06-22 Thread Andreas Hennings
Hello Rowan, Ilja, (sorry I did not see these replies sooner, I do some forwarding but it failed) On Sat, 17 Jun 2023 at 16:59, Rowan Tommins wrote: > > On 17/06/2023 12:26, Ilija Tovilo wrote: > > I don't believe blocks for general expressions are that useful in PHP > > due to the lack of block

Re: [PHP-DEV] Expression code blocks

2023-06-17 Thread Rowan Tommins
On 17/06/2023 12:26, Ilija Tovilo wrote: I don't believe blocks for general expressions are that useful in PHP due to the lack of block scoping. Your suggestion to make the block a separate closure could avoid that (as well as the optimizer issue mentioned below) but comes with new issues, like m

Re: [PHP-DEV] Expression code blocks

2023-06-17 Thread Ilija Tovilo
Hi Andreas On Fri, Jun 16, 2023 at 9:23 PM Andreas Hennings wrote: > > Hello list, > I don't know if something like this was already proposed in the past, > I did not find anything. > > Sometimes it would be nice to have a code block inside an expression, like > this: > > public function f(strin

[PHP-DEV] Expression code blocks

2023-06-16 Thread Andreas Hennings
Hello list, I don't know if something like this was already proposed in the past, I did not find anything. Sometimes it would be nice to have a code block inside an expression, like this: public function f(string $key) { return $this->cache[$key] ??= { // Calculate a value for $key.