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

Deprecate clamp soon? #374

Closed
Xaeroxe opened this issue Mar 19, 2019 · 2 comments
Closed

Deprecate clamp soon? #374

Xaeroxe opened this issue Mar 19, 2019 · 2 comments

Comments

@Xaeroxe
Copy link
Contributor

Xaeroxe commented Mar 19, 2019

rust-lang/rust#58710 was just merged into master. This may be cause to deprecate the num::clamp function in the near future.

@cuviper
Copy link
Member

cuviper commented Mar 19, 2019

Ord::clamp won't be stable until rust-lang/rust#44095 closes and reaches a release. Even then, I don't see the harm in keeping num's function around. num-traits supports pretty old compilers, and it would be annoying to get a deprecation message there that you can't act on yet.

Plus there's support for PartialOrd, however questionable that may be. You've implemented clamp on f32 and f64, but that won't help newtype floats, for instance.

@Xaeroxe
Copy link
Contributor Author

Xaeroxe commented Mar 19, 2019

Yeah that's reasonable. My only reason for thinking we should maybe deprecate this is that std's clamp will account for 99% of use cases, and it's nice to unify code "look". Though tbh since this function is unopinionated about the input or output type it's completely harmless to keep around.

@Xaeroxe Xaeroxe closed this as completed Sep 9, 2020
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

2 participants