You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
slices.Min, slices.MinFunc, slices.Max and slices.MaxFunc cause a panic if the given slice is empty.
However, if a panic causes, the execution side will not be able to properly handle the error.
Therefore, I want these functions to also return a error as a return value.
The text was updated successfully, but these errors were encountered:
Panic mode is documented and caller code that does not check that slice is empty is not following function contract.
With your proposal caller would have to check error result so it does not reduce code complexity, just moves the check to later phase.
IMO given that these functions are already deployed it is unlikely this change would be accepted.
slices.Min
,slices.MinFunc
,slices.Max
andslices.MaxFunc
cause a panic if the given slice is empty.However, if a panic causes, the execution side will not be able to properly handle the error.
Therefore, I want these functions to also return a
error
as a return value.The text was updated successfully, but these errors were encountered: