Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider an Interval type in the core lib #70

Open
benhutchison opened this issue Feb 24, 2021 · 0 comments
Open

Consider an Interval type in the core lib #70

benhutchison opened this issue Feb 24, 2021 · 0 comments

Comments

@benhutchison
Copy link

The idea of an interval is central to a large portion of programming logic.

Please consider defining a bounded or half-open interval type in the core Scala lib. Currently, the choices are

  • Use a tuple (n1, n2). The intent isn't clear and there's no enforcement of invariants that n needs to be ordered and n1 < n2.
  • Use a library like Spire or Continuuum. This is a heavy dependency bringing a lot of baggage if all you wanted was to express simple business logic like eg "Item count must be between 1 and 5".

Note that Range is a distinct if related idea; an enumerable sequence of integers. Intervals can be defined over a wider set of types, and need not be enumerable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant