On 5 January 2024 20:44:00 GMT, "Mönôme Epson" <glash.gnome@gmail.com> wrote:
>Hello internals,
>
>> The purpose of list() is to assign a list of variables.
>
>What should be the underlying concept behind the list() language construct?
>
>I propose that list() is the reciprocal of array().
>That is, if array() is a function call, then list() is the signature of a
>function.
>
>Do you agree ?
>
>Regards, Alexandre
>
>PS: For historical reason, i propose to allow to syntaxe :
>list(name: $name) = ['name'=>$name];// maybe discussed
>list('name'=> $name) = ['name'=>$name];
I'm not sure what your question is, but the second option, with => as in all PHP contexts, already works: https://3v4l.org/dqgal
Note that neither array() nor list() are functions, and both can be spelled [] as in
['name'=> $name2] = ['name'=>$name1];
https://3v4l.org/Uu5e4
The name for this if you want to find more information is "array destructuring".
Regards,
--
Rowan Tommins
[IMSoP]