Hi Levi Morrison,
> A bit off topic, but not entirely:
>
> In my opinion, adding another flag isn't the _real_ fix. Any function
> which does comparisons should take a callable for users to provide any
> comparison they wish. An iteratively better API would be:
>
> function array_unique(list $
To avoid noise I will respond to all e-mails at once.
---
Hi someniatko
> Perhaps an alternative idea is to provide a default string value for
> enums which are not baked,
> Nikolas had already brought up this idea earlier.
As others have mentioned, this opens the door for type coercion issues
A bit off topic, but not entirely:
In my opinion, adding another flag isn't the _real_ fix. Any function
which does comparisons should take a callable for users to provide any
comparison they wish. An iteratively better API would be:
function array_unique(list $array, callable(T $a, T $b): in
On 04.11.2022 at 10:05, Rowan Tommins wrote:
> On 3 November 2022 18:53:40 GMT, someniatko wrote:
>
>> You will have to memorize yet another PHP quirk, or be able to build a
>> logical chain:
>> - enums are non-comparable by default
>> - enums have no default string value (if not baked by a strin
On 3 November 2022 18:53:40 GMT, someniatko wrote:
>You will have to memorize yet another PHP quirk, or be able to build a
>logical chain:
>- enums are non-comparable by default
>- enums have no default string value (if not baked by a string)
>- array_unique internally sorts an array
>- default fl
> To solve this, I propose adding an ARRAY_UNIQUE_IDENTICAL option that
> can be passed to array_uniques $flags which uses identical operator
> (===) semantics. Internally it uses a new hashmap that allows using
> arbitrary PHP values as keys to efficiently remove duplicates. This is
> slightly ove