nobuco
nobuco copied to clipboard
Extended return
Developers will want to programmatically analyze the result of conversion in a more detailed manner. Therefore, I suggest returning the validation and conversion results as well after conversion.
From the perspective of Clean Code, it's better to return a consistent type. See the examples below. If we use a Union
as the return type, your IDE will be confused about the type of the returned variables.
In the case of func
, the second
variable must be an int
, but we can see that Intellisense recommends autocompletion from both int
and str
.
In the case of func2
, the autocompletion is limited to the designed targets.