RE: [PHP-DEV] [RFC][List/Assoc\unique]
| From: | CHU Zhaowei | Date: | Mon, 05 Dec 2022 18:52:16 +0000 |
| Subject: | RE: [PHP-DEV] [RFC][List/Assoc\unique] | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119091@lists.php.net to get a copy of this message | ||
Hi Ilija,
Thanks for the RFC. In general, I like the idea but there are certain things not clear to me.
1. What will happen if we pass a list to
Assoc\unique?
```
Assoc\unique([1, 2, 3, 1]);
```
2. What will happen if the array (no matter list or assoc) contains pure value and reference which
are strict equal? As the RFC says "references are preserved."
```
$a = 1;
$arr1 = [$a, &$a];
$arr2 = [&$a, $a];
List\unique($arr1);
List\unique($arr2);
```
3. Currently the RFC (proposal section, function signature) claims the parameter are bool type,
which is obvious wrong. But this is just a minor mistake, what I really want to ask here is do we
support array only or any array like input?
> Side note: I *really* hope the discussion will be about more than just the namespaces.
Adding two new namespaces with single function doesn't look good to me, especially I cannot
think of anything that we may add to these two namespace in the future.
Regards,
CHU Zhaowei