icecave / collections

A PHP collection library loosely inspired by the .NET runtime and the C++ STL. [DEPRECATED]
MIT License
70 stars 2 forks source link

Add Set removal operations that throw on failure. #77

Open jmalloc opened 10 years ago

jmalloc commented 10 years ago

Currently, Set::remove*() returns a boolean indicating whether the element(s) being removed were found. We need a variant of this operation that throws if the element is not found.

I'd prefer to rename the existing operations to discard*() and change remove*() into the strict variants. This matches Python's set type and some others, however this is a BC break with very little justification. So failing that we need to come up with a good name and I tend to dislike things like removeStrict()... what's it being strict about? Further to that 'strict' already has a pretty specific meaning in set theory.