On Sun, 19 Dec 2010 05:33:56 -0000, Matthew Turland <tobias...@gmail.com>
wrote:

Attached are source/test and manual patches for the addition of two
methods to the SplObjectStorage class. These methods, removeCommon and
removeUncommon, add support for the difference and intersection set
operations, respectively.

I'm sorry, I must be missing something because what exactly is the
difference between removeCommon and removeAll?

I think it's unfortunate that SplObjectStorage chose the Java naming of
the set operation methods instead of following PHP's choice for arrays:

* "diff" for the complement
* "intersect" for the intersection
* "merge" for the union

(You could argue that Java's naming is more appropriate because, contrary
to the array functions, the methods have collateral affects that are
better expressed with "remove" and "add".)

In any case, consistency would dictate the difference should be called
"removeAll", intersection should be called "retainAll" and the union
should be called "addAll".

--
Gustavo Lopes

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

Reply via email to