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

Timer::{percent,percent_left} should be renamed #10439

Closed
mamekoro opened this issue Nov 8, 2023 · 3 comments · Fixed by #10442
Closed

Timer::{percent,percent_left} should be renamed #10439

mamekoro opened this issue Nov 8, 2023 · 3 comments · Fixed by #10442
Labels
A-Time Involves time keeping and reporting C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@mamekoro
Copy link
Contributor

mamekoro commented Nov 8, 2023

Bevy version

0.12.0

What went wrong

Timer::percent() and Timer::percent_left() should use the word "fraction" or "frac" instead of "percent" for their names.

The reasons are as follows;

  • When I hear the word "percent", I imagine a value in the range of 0 to 100, but these functions return a value from 0 to 1, which causes confusion.

  • It is confusing when the same word is used for several different behaviors. e.g. Timer::percent() returns a value from 0 to 1, but Val::Percent holds a value from 0 to 100. Both of these APIs contain the word "percent" but have different meanings.

@mamekoro mamekoro added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Nov 8, 2023
@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Time Involves time keeping and reporting and removed C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Nov 8, 2023
@alice-i-cecile
Copy link
Member

Definitely agree. Please feel free to make a PR!

@mamekoro
Copy link
Contributor Author

mamekoro commented Nov 8, 2023

Which word should I use, "fraction" or "frac"?

@AlexAegis
Copy link

I vote for fraction, haven't really heard frac being used before, and percent wasnt shortened to perc either

github-merge-queue bot pushed a commit that referenced this issue Nov 13, 2023
…rstep_percentage_f64()` (#10448)

# Objective
This is similar to #10439.

`Time::<Fixed>::overstep_percentage()` and
`Time::<Fixed>::overstep_percentage_f64()` returns values from 0.0 to
1.0, but their names use the word "percentage". These function names
make it easy to misunderstand that they return values from 0.0 to 100.0.

To avoid confusion, these functions should be renamed to
"`overstep_fraction(_f64)`".

## Solution
Rename them.

---

## Changelog

### Changed
- Renamed `Time::<Fixed>::overstep_percentage()` to
`Time::<Fixed>::overstep_fraction()`
- Renamed `Time::<Fixed>::overstep_percentage_f64()` to
`Time::<Fixed>::overstep_fraction_f64()`

## Migration Guide
- `Time::<Fixed>::overstep_percentage()` has been renamed to
`Time::<Fixed>::overstep_fraction()`
- `Time::<Fixed>::overstep_percentage_f64()` has been renamed to
`Time::<Fixed>::overstep_fraction_f64()`
github-merge-queue bot pushed a commit that referenced this issue Nov 13, 2023
…remaining}` (#10442)

# Objective
Fixes #10439

`Timer::percent()` and `Timer::percent_left()` return values in the
range of 0.0 to 1.0, even though their names contain "percent".

These functions should be renamed for clarity.

## Solution
- Rename `Timer::percent()` to `Timer::fraction()`
- Rename `Timer::percent_left()` to `Timer::fraction_remaining()`

---

## Changelog

### Changed
- Renamed `Timer::percent()` to `Timer::fraction()`
- Renamed `Timer::percent_left()` to `Timer::fraction_remaining()`

## Migration Guide
- `Timer::percent()` has been renamed to `Timer::fraction()`
- `Timer::percent_left()` has been renamed to
`Timer::fraction_remaining()`
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
…rstep_percentage_f64()` (bevyengine#10448)

# Objective
This is similar to bevyengine#10439.

`Time::<Fixed>::overstep_percentage()` and
`Time::<Fixed>::overstep_percentage_f64()` returns values from 0.0 to
1.0, but their names use the word "percentage". These function names
make it easy to misunderstand that they return values from 0.0 to 100.0.

To avoid confusion, these functions should be renamed to
"`overstep_fraction(_f64)`".

## Solution
Rename them.

---

## Changelog

### Changed
- Renamed `Time::<Fixed>::overstep_percentage()` to
`Time::<Fixed>::overstep_fraction()`
- Renamed `Time::<Fixed>::overstep_percentage_f64()` to
`Time::<Fixed>::overstep_fraction_f64()`

## Migration Guide
- `Time::<Fixed>::overstep_percentage()` has been renamed to
`Time::<Fixed>::overstep_fraction()`
- `Time::<Fixed>::overstep_percentage_f64()` has been renamed to
`Time::<Fixed>::overstep_fraction_f64()`
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
…remaining}` (bevyengine#10442)

# Objective
Fixes bevyengine#10439

`Timer::percent()` and `Timer::percent_left()` return values in the
range of 0.0 to 1.0, even though their names contain "percent".

These functions should be renamed for clarity.

## Solution
- Rename `Timer::percent()` to `Timer::fraction()`
- Rename `Timer::percent_left()` to `Timer::fraction_remaining()`

---

## Changelog

### Changed
- Renamed `Timer::percent()` to `Timer::fraction()`
- Renamed `Timer::percent_left()` to `Timer::fraction_remaining()`

## Migration Guide
- `Timer::percent()` has been renamed to `Timer::fraction()`
- `Timer::percent_left()` has been renamed to
`Timer::fraction_remaining()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Time Involves time keeping and reporting C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants