Hi!

> $counts[$item] ?? $counts[$item] = 1 ?? $counts[$item]++;

This looks completely unreadable and I do not think it works:
https://3v4l.org/PlAHH
Seems to leave $counts as 1 always. But even if it didn't, I would never
pass that on code review - it is very hard to understand what's going on
and it is incredibly easy to break it. Doing such stuff is definitely
not the solution, if you hate @, then if() is way better, at least it's
clear.

> $item = new StdClass;
> @$counts[$item] = "This is a bad use of error suppression.";
> 
> There is no insertion, because arrays don't support object keys. The
> operation completly failed and so there should be an exception.

No, there should not. If somebody tries to count garbage, I just don't
want to count it. I don't care about it, it's garbage.

> Currently that code fails silently.

And that is exactly what I want it to do. Sometimes silent failure is
*good*, I don't want to know about every little thing that could go
wrong, I just want what's right to be done.
Of course, your intent may be the opposite - but that's exactly the
point, there's more than one use case.
-- 
Stas Malyshev
smalys...@gmail.com

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

Reply via email to