dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.82k stars 772 forks source link

Unify exceptions for out of bounds conditions in core functions #17351

Open psfinaki opened 3 days ago

psfinaki commented 3 days ago

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_

vzarytovskii commented 3 days ago

All those will be breaking changes, fwiw.

psfinaki commented 3 days ago

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