Replies: 7 comments 5 replies
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
-
We will implement the idea #315 instead of this one. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
🤔 The problem
Some type converters provided by Kotools Types encapsulate their result in a
Result
type (thetoNotEmptyList
function for example).But this practice increases the complexity of the API by using a concept that is not widely accepted in the Kotlin community. Also, this concept of a possible failure could be easily representable with an absence of value - the
null
expression.💡 The idea
For aligning with our design goals on being agnostic about error handling, Kotools Types should provide an explicit API by definition.
This is why we would like to align our type converters with the following principles:
OrNull
should returnnull
in case of a failure.✅ Checklist
Here's the checklist to address for implementing this idea:
OrNull
, implemented by:OrNull
andOrThrow
forStrictlyPositiveDouble
#132OrNull
andOrThrow
forStrictlyPositiveInt
#141OrNull
andOrThrow
forStrictlyNegativeInt
#149OrNull
andOrThrow
forPositiveInt
#155OrNull
andOrThrow
forNegativeInt
#171OrNull
andOrThrow
forNonZeroInt
#173OrNull
andOrThrow
forNotBlankString
#174OrNull
andOrThrow
forNotEmptyList
#176OrNull
andOrThrow
forNotEmptySet
#178OrNull
andOrThrow
forNotEmptyMap
#179OrNull
#262Result
#263Result
to error level #265Result
to hidden level #266Result
#267ResultContext
#264ResultContext
to error level #268ResultContext
to hidden level #269ResultContext
#270🙏 Help needed
Please give this post a reaction if you are interested in this change and comment below your thoughts on it.
We would love to have your feedback!
Beta Was this translation helpful? Give feedback.
All reactions