-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Remove fNN::lerp #90296
Remove fNN::lerp #90296
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This sounds reasonable. @clarfonthey I'd like to hear your thoughts on this. |
r=me on the implementation |
It's honestly disappointing to see things end up this way but I think I agree for now. If we see a standard IEEE lerp definition then we can add it back in. |
@bors r+ |
📌 Commit 6b449b4 has been approved by |
Remove fNN::lerp Lerp is [surprisingly complex with multiple tradeoffs depending on what guarantees you want to provide](rust-lang#86269 (comment)) (and what you're willing to drop for raw speed), so we don't have consensus on what implementation to use, let alone what signature - `t.lerp(a, b)` nicely puts `a, b` together, but makes dispatch to lerp custom types with the same signature basically impossible, and major ecosystem crates (e.g. nalgebra, glium) use `a.lerp(b, t)`, which is easily confusable. It was suggested to maybe provide a `Lerp<T>` trait and `t.lerp([a, b])`, which _could_ be implemented by downstream math libraries for their types, but also significantly raises the bar from a simple fNN method to a full trait, and does nothing to solve the implementation question. (It also raises the question of whether we'd support higher-order bezier interpolation.) The only consensus we have is the lack of consensus, and the [general temperature](rust-lang#86269 (comment)) is that we should just remove this method (giving the method space back to 3rd party libs) and revisit this if (and likely only if) IEEE adds lerp to their specification. If people want a lerp, they're _probably_ already using (or writing) a math support library, which provides a lerp function for its custom math types and can provide the same lerp implementation for the primitive types via an extension trait. See also [previous Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/lerp.20API.20design) cc `@clarfonthey` (original PR author), `@m-ou-se` (original r+), `@scottmcm` (last voice in tracking issue, prompted me to post this) Closes rust-lang#86269 (removed)
@clarfonthey This is still something I'd also still like in the abstract to have -- I think it's good functionality -- it's just the semantic and interface uncertainty pushing me this way for now. |
…askrgr Rollup of 4 pull requests Successful merges: - rust-lang#90296 (Remove fNN::lerp) - rust-lang#90302 (Remove unneeded into_iter) - rust-lang#90303 (Add regression test for issue 90164) - rust-lang#90305 (Add regression test for rust-lang#87258) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Yeah, mostly the same opinion. I do hope that in the future we see some widespread standardisation of a lerp operation, considering how ubiquitous it is. |
Lerp is surprisingly complex with multiple tradeoffs depending on what guarantees you want to provide (and what you're willing to drop for raw speed), so we don't have consensus on what implementation to use, let alone what signature -
t.lerp(a, b)
nicely putsa, b
together, but makes dispatch to lerp custom types with the same signature basically impossible, and major ecosystem crates (e.g. nalgebra, glam) usea.lerp(b, t)
, which is easily confusable. It was suggested to maybe provide aLerp<T>
trait andt.lerp([a, b])
, which could be implemented by downstream math libraries for their types, but also significantly raises the bar from a simple fNN method to a full trait, and does nothing to solve the implementation question. (It also raises the question of whether we'd support higher-order bezier interpolation.)The only consensus we have is the lack of consensus, and the general temperature is that we should just remove this method (giving the method space back to 3rd party libs) and revisit this if (and likely only if) IEEE adds lerp to their specification.
If people want a lerp, they're probably already using (or writing) a math support library, which provides a lerp function for its custom math types and can provide the same lerp implementation for the primitive types via an extension trait.
See also previous Zulip discussion
cc @clarfonthey (original PR author), @m-ou-se (original r+), @scottmcm (last voice in tracking issue, prompted me to post this)
Closes #86269 (removed)