Hi all,

I am goiing to reply to the thread with this single email.

Firstly assignment expressions works well in this context.
The first token before `=` of `[$x = $y]` is different to `[$x, =$y]`.
Hence it will never conflict.

Secondly for compact and extract functions. I was aware.
The different is

a. They can't mix the shorthand with explicit keys: 
```
$user = ['id' => 1, =$name, =$age];
```
b. extract overwrite vars with the same name. But in this context
we can declare the var name to be written
```
[=$name] = $row
```
c. They don't work in foreach loop.

Thirdly to prove its usefulness. Well, I'd say this works well with
my experience esp in returning arrays for functions. Because in my
code base, the local var's name could be the same to its key's name
and if some of it don't we just exlicitly state it there.
```
return ['x' => $point_x, =$y, =$z];
```

If you want me to prove this pattern in the code base. It's hard to
give out the overall statistics but I can provide some usage in famous
php project I see [1][2][3][4]

Thus, I am not convinced. This feels useful in my experience. But I know
different devs have various taste to pl design and I am one of those perl
fan when it comes to this syntax. And I can see why some may feel bad in
it. 

I will leave the DTO stuff after I done the implementation. However, it feels
like I can already withdraw this RFC given the state of current discussion.

Thanks for ideas anyways :)

BR,
Weilin Du

[1]: 
https://github.com/composer/composer/blob/d25ce76a0624857740fe238e0b63ac09e82bbd8f/src/Composer/Command/RunScriptCommand.php#L181
[2]: 
https://github.com/laravel/framework/blob/6070a6d7e9804a490b12cb889173fbb926b8e3c8/src/Illuminate/Cache/DatabaseStore.php#L225
[3]: 
https://github.com/sebastianbergmann/phpunit/blob/027d1eb8cac21f6c9b9427ea9437d61785489fc4/src/TextUI/Configuration/SourceMapper.php#L96
[4]: 
https://github.com/symfony/http-foundation/blob/1c588354b1d2c94ed588edc33914bbf2978cd3ce/FileBag.php#L116

Reply via email to