fsharp icon indicating copy to clipboard operation
fsharp copied to clipboard

Unify exceptions for out of bounds conditions in core functions

Open psfinaki opened this issue 1 year ago • 2 comments

We have 3 different behaviors currently: X.skip throws InvalidArgOutOfRange when count > n X.take throws InvalidOperation when count > n X.sample throws InvalidArg when count > n

We should unify this, updating the code along with RFCs probably.

Originally posted by @Lanayx in https://github.com/dotnet/fsharp/pull/17277#discussion_r1653866870

psfinaki avatar Jun 26 '24 15:06 psfinaki

All those will be breaking changes, fwiw.

vzarytovskii avatar Jun 26 '24 16:06 vzarytovskii

Yeah that's clear, don't expect this to be easy-breezy :shrug:

psfinaki avatar Jun 26 '24 16:06 psfinaki

Agree, should be InvalidArgOutOfRange for all 3 APIs.

T-Gro avatar Jul 08 '24 16:07 T-Gro