On Tue, Apr 2, 2024 at 8:05 PM Ilija Tovilo <tovilo.il...@gmail.com> wrote:

> Equality for data objects is based on data, rather than the object
> handle.

I believe equality should always consider the type of the object.

```php
new Problem(size:'big') === new Universe(size:'big')
&& new Problem(size:'big') === new Shoe(size:'big');
```

If the above can ever be true then I'm not sure how big is the problem
(but probably very big).
Also see the examples of non-comparable ids - `new CompanyId(1)`
should not be equal to `new PersonId(1)`

And I'd find it very confusing if the following crashed

```php
function f(Universe $_u): void {}
$universe = new Universe(size:'big');
$shoe = new Shoe(size:'big);

if ($shoe === $universe) {
   f($shoe); // shoe is *identical* to the universe, so it should be
accepted wherever the universe is
}
```

-- 
  Best regards,
      Bruce Weirdan                                     mailto:weir...@gmail.com

Reply via email to