Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Re: [PATCH] SplObjectStorage::removeCommon and removeUncommon [RSS Feed]

#1 Dec. 20, 2010 20:06:42

Gustavo L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Re: [PATCH] SplObjectStorage::removeCommon and removeUncommon

On Mon, 20 Dec 2010 19:41:29 -0000, Matthew Turland <tobias***@*mail.com>wrote:Thanks to comments from Gustavo Lopes, I've removed the removeCommon
method from my patch. I honestly wish I could say why I didn't realize
his point before I submitted the patch in the first place, but I
appreciate the feedback. I've attached the amended patch files, which
include only the removeUncommon method, which I definitely know does
not already exist in the class.

php-src-5.3-patch.diff is against php/php-src/branches/PHP_5_3
phpdoc-en-trunk-patch.diff is against phpdoc/en/trunk

As for the comments regarding the naming conventions, I do agree to a
certain extent. However, I would like to remain consistent with the
format of names of existing methods. I suggest a separate patch be
submitted with method aliases to deal with that situation. If anyone
has a better name for the removeUncommon method, I'm open to

Any further feedback and/or approval/merging would be appreciated."Remain consistent with the format of names of existing methods"would imply calling the method "retainAll" since the set operations"addAll" and "removeAll" are presumably inspired in Java and "retainAll"is the name given to the method that has these semantics. I would berelatively comfortable with something like "removeExceptAll" or"intersectWith" but the first is awkward and the second would be moreappropriate for a method that would return a new set instead of relying oncollateral effects.I think "removeUncommon" is an infelicitous choice, it forces you to thinkabout what the "uncommon" elements in the two sets are, which isunnecessary to understand the semantics of the method; all you have to dois remove everything from the first that isn't in the second (or retainthe common ones), i.e., the uncommon ones on the second don't matter atall. "retainAll" and "removeExceptAll" express this clearly,"intersectWith" has an immediate visual appeal, "removeUncommon" is a bigcognitive burden.Other than that, +1

Gustavo Lopes

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


  • Root
  • » PHP
  • » [PHP-DEV] Re: [PATCH] SplObjectStorage::removeCommon and removeUncommon [RSS Feed]

Board footer

Moderator control

Enjoy the 14th of December

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support