2
$\begingroup$

There is a definition for kind of actions that only care for outcome.
Classic example for such an action is remove from collection:
When you try to remove an item that doesn't exist in collection, there are two possible outcomes: failure with item doesn't exist or success (because the outcome is that the item doesn't exist).
I'm interested in the second one. How do you call remove that succeeds when the item it is trying to remove is not present?

$\endgroup$
  • 1
    $\begingroup$ One possible term is silent failure. $\endgroup$ – Yuval Filmus Dec 6 '17 at 15:33
0
$\begingroup$

This doesn't actually answer the question but it fits to be an answer.
What I looked for is idempotent (when I asked this question I was actually looking for this word, but failed to express myself properly). The definition is quite different from the question asked here:

In computing, an idempotent operation is one that has no additional effect if it is called more than once with the same input parameters. For example, removing an item from a set can be considered an idempotent operation on the set.

But indeed, any operation that is idempotent will meet the question criteria.

$\endgroup$
0
$\begingroup$

With reference to your answer, the first form is also idempotent, except that it gives a diferent answer. Both versions remove the element from the set if it was there and don't change the set if the element wasn't there.

This is about the specification of the function: do you want returned the information that the element was in the set or not? The first (you want the information) means the function must return this information; the second (you don't care) means the function does not need to return the information (but could and you could choose to ignore the information).

In C this would be:

void remove(tElement *element);  // remove element, if there

int  remove(tElement *element);  // remove element, if there, and tell me
$\endgroup$
  • $\begingroup$ Yep, you're right. It also depends on what you're considering as an "effect". If it's an effect on data structure then in any case the operation is idempotent. But if it's an effect on the function (or flow, or object) then the operation is not idempotent in case of failure. $\endgroup$ – JeB Jan 2 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.