Do you guys know if there's any particular reason ...
# stdlib
l
Do you guys know if there's any particular reason for
Char.isDigit
to not have it's opposite
Char.isNotDigit
?
s
I'll go ahead and add this to the kotlin-extensions library
👍🏼 1
l
Great, Tyler!
Still worth to understand why it's not in stdlib
i
Do you imply that every
is*
-function should have
isNot*
counterpart, as if there was no
!
(not) operator?
l
That's what I thought, yes
Unless it's confusing (for instance, if there's an OR in the function)
We see that for many operations, such as
String.isBlank
,
String.isEmpty
,
List.isEmpty
, Sequence
i
Yes there are shortcuts for some common cases, but for others
not
operator is pretty enough
l
I mean, the
not
operator is always enough... But perhaps it's more expressive to use the
not
in the function
And it's way too overkill to implement an extension function for that
Is it harmful or unclear in any way? For the
Char.isNotDigit
example?
i
It's not unclear but rather redundant in presence of the operator.