Skip to content

Remove None from Interval type parameter#178

Merged
llucax merged 1 commit into
frequenz-floss:v1.x.xfrom
llucax:interval-none
Jul 8, 2026
Merged

Remove None from Interval type parameter#178
llucax merged 1 commit into
frequenz-floss:v1.x.xfrom
llucax:interval-none

Conversation

@llucax

@llucax llucax commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Interval's type parameter no longer includes None. The exported type variable LessThanComparableOrNoneT (bound to LessThanComparable | None) was deprecated and replaced with LessThanComparableT (bound to LessThanComparable).

None is still accepted as a value for start / end to indicate an unbounded side, but it is treated purely as bound metadata rather than a value in the interval's comparable space.

Note that explicitly using Interval[int | None] still works, as (int | None) | None is equivalent to int | None, even when it is no longer needed nor recommended. Old code will mostly work, but there is one soft breaking change: None in some_interval and None in some_interval_set is now a type-check error at call sites, matching the design intent that None is a bound marker and never a member value.

@llucax llucax requested a review from a team as a code owner July 2, 2026 13:32
@llucax llucax requested review from Marenz and removed request for a team July 2, 2026 13:32
@github-actions github-actions Bot added part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests labels Jul 2, 2026
@llucax llucax added this to the v1.4.0 milestone Jul 2, 2026
@github-actions github-actions Bot added the part:math Affects the math module label Jul 2, 2026
@llucax llucax self-assigned this Jul 2, 2026
@llucax

llucax commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

The idea is to start using Interval for Bounds and Lifetime in client-common, so it would be nice to merge this soon, it removes a lot of unnecessary verbosity.

@llucax llucax enabled auto-merge July 2, 2026 13:33
@llucax

llucax commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

`Interval`'s type parameter no longer includes `None`. The exported type
variable `LessThanComparableOrNoneT` (bound to
`LessThanComparable | None`) was deprecated and replaced with
`LessThanComparableT` (bound to `LessThanComparable`).

`None` is still accepted as a value for `start` / `end` to indicate an
unbounded side, but it is treated purely as bound metadata rather than
a value in the interval's comparable space.

Note that explicitly using `Interval[int | None]` still works, as
`(int | None) | None` is equivalent to `int | None`, even when it is no
longer needed nor recommended. Old code will mostly work, but there is
one soft breaking change: `None in some_interval` and
`None in some_interval_set` is now a type-check error at call sites,
matching the design intent that `None` is a bound marker and never a
member value.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax llucax added this pull request to the merge queue Jul 8, 2026
Merged via the queue into frequenz-floss:v1.x.x with commit 284d536 Jul 8, 2026
9 checks passed
@llucax llucax deleted the interval-none branch July 8, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:math Affects the math module part:tests Affects the unit, integration and performance (benchmarks) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants