Le 18/10/2023 à 14:50, someniatko a écrit :
Hi internals,

This approach allows combining
- no BC break - `~=` is a new syntax which is unavailable in older PHP
versions
- explicitly showing an intent that objects are compared using a custom
comparison, rather than standard PHP one
- allow to skip writing boilerplate equals() methods which just forward
equals() to the nested objects
- standardize such comparisons on the language level

Of course how exactly this operator looks may be changed, `~=` is just an
example.

WDYT?

I'm not fond of operator overloading, I actually quite hate it, I like the expressiveness of an equals() method.

I would very much prefer to have a set of standard interfaces such as Comparable { compareTo($other): int } or Equatable { equals($other): bool; } which the standard API and userland libraries could make use of.

In all cases, I don't like the ~= choice because in my mind it literally translates to "is approximately/barely/maybe comparable to".

By the way, please  do not use abbreviations such as WDYT, I'm not a native english speaker and I don't know all abbreviations, I had to duckduckgo' it.

Regards,

--

Pierre

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to