nobuco icon indicating copy to clipboard operation
nobuco copied to clipboard

Extended return

Open crimson206 opened this issue 7 months ago • 6 comments

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.

func_int func_str func2_int func2_list

crimson206 avatar Jul 20 '24 07:07 crimson206