Uh oh!
There was an error while loading. Please reload this page.
Remove fNN::lerp - #90296
Conversation
rust-highfive
commented
Oct 26, 2021
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
m-ou-se
commented
Oct 26, 2021
This sounds reasonable. @clarfonthey I'd like to hear your thoughts on this. |
Mark-Simulacrum
commented
Oct 26, 2021
r=me on the implementation |
clarfonthey
commented
Oct 26, 2021
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. |
Mark-Simulacrum
commented
Oct 26, 2021
@bors r+ |
bors
commented
Oct 26, 2021
📌 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) Closesrust-lang#86269 (removed)
scottmcm
commented
Oct 26, 2021
@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
clarfonthey
commented
Oct 26, 2021
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, btogether, 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)