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

Replace integer_quotient with unblock_int_div #315

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

chiphogg
Copy link
Contributor

Instead of integer_quotient(a, b), we now always write
a / unblock_int_div(b). This gives us everything we used to have with
integer_quotient, but with two big advantages:

  1. The form for the units code becomes more similar to the non-units
    code that it replaces (i.e., we're using the / symbol).

  2. We can now support templated code that works for both integral and
    non-integral types: a / unblock_int_div(b) works equally well for,
    say, b with floating point rep.

There's no longer any use case for integer_quotient. We therefore
immediately deprecate it. We will keep it deprecated for the entirety
of the 0.4.0 cycle, and remove it for 0.5.0.

Fixes #253.

Instead of `integer_quotient(a, b)`, we now always write
`a / unblock_int_div(b)`.  This gives us everything we used to have with
`integer_quotient`, but with two big advantages:

1. The form for the units code becomes more similar to the non-units
   code that it replaces (i.e., we're using the `/` symbol).

2. We can now support _templated code_ that works for both integral and
   non-integral types: `a / unblock_int_div(b)` works equally well for,
   say, `b` with floating point rep.

There's no longer any use case for `integer_quotient`.  We therefore
immediately deprecate it.  We will keep it deprecated for the entirety
of the 0.4.0 cycle, and remove it for 0.5.0.

Fixes #253.
@chiphogg chiphogg added release notes: ✨ lib (enhancement) PR enhancing the library code release notes: 🗑️ lib (deprecation) PR deprecating library functionality labels Oct 29, 2024
@chiphogg chiphogg requested a review from geoffviola October 29, 2024 23:33
Copy link
Contributor

@geoffviola geoffviola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I do like the / operator over integer_quotient. It is more familiar in terms of operator precedence and argument order.

@chiphogg chiphogg merged commit fbe3d45 into main Oct 30, 2024
11 checks passed
@chiphogg chiphogg deleted the chiphogg/unblock-int-div#253 branch October 30, 2024 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: 🗑️ lib (deprecation) PR deprecating library functionality release notes: ✨ lib (enhancement) PR enhancing the library code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide more flexible alternative to integer_quotient()
2 participants