Firstly, isIsolatingCurrentContext
: @ktoso says the nil
result is 'in order to be able to determine the "we don't know" vs "definitely no"'. For isKnownIdentical
however, the two suggested non-true results aren't like this, but rather "we don't know" and again "we don't know".
Secondly, _customContainsEquatableElement
: when given this nil
result the caller needs to do more work to determine a correct value. But for isKnownIdentical
, the caller needs to do more, identical work when receiving either nil
or false
.
I'm arguing that isKnownIdentical
as proposed doesn't have semantic tripartite result true
, false
, and nil
but instead that it has the semantic result of true and not-true where the latter is expressed by either false
or nil
.
Well, not quite arguing it, I'm wanting to explore that possibility :^) I'm asking if there's any conceivable case where the caller would care false
vs. nil
because I can't think of any.
Yes, I'm thinking of the caller's point of view. The Equatable
type knows the difference between those 2 not-true states, but we could imagine lots of functions where the callee has internal state it may feel like leaking to the caller even though it's not needed or ever helpful.
Somebody who gets what I'm talking about, could you come up with an example? The one I was going to include was the Character
property var isWhitespace: Bool
instead being a function returning .true
, .falseBecauseNonWhitespaceASCII
, .falseBecauseNonWhitespaceUnicode
, .falseBecauseEmoji
but that's not even a good example because the caller might indeed like to know both if whitespace and separately if ASCII or emoji making this conceivably useful, even though weird for a function named isWhitespace
.
To callers of isKnownIdentical
the nil
vs false
result is, in contrast, useless trivia AFAIK. Again, I'm asking to be proved wrong, to illuminate a reason the caller might find use in the proposed tripartite function result.