-
Notifications
You must be signed in to change notification settings - Fork 141
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
feat: ToPrimitive split into ToFloatPrimitive and ToIntegerPrimitive #316
Comments
I would be happy to PR it solution has chances to be accepted |
Other option is to gate all float methods behind float feature |
I have no plans to start making breaking changes. For now, I think if you have such restricted needs, it might be better to just fork into a new crate for your environment. |
Thanks for response. Forking is not good option as will need fork whole crate tree built on top. Smallest breaking change can be made by making disable of floats only if no default no-floats features is defined. Only issue would be if |
Features are meant to be additive. If crate A uses
API changes also require the whole tree to adapt, and this crate has thousands of dependents. You may be able to |
It looks very desired behavior. If somebody enables "disabling" feature, it will break all float usage in other crates, compilation will fail, which is right. Nobody to use floats.
that is clear, anyway just tried to propose :) so need to adapt on forks or via gate(both likely).
Patch will patch crate for all deps, so if any dep will impl float methods, they will fail to compile. So will need to patch all other crates built on top. Num based crates about fractions(ratio) and big integers(bigger than 128) are of interest.
Thank you for response. I understand. So my understanding (and usage), there are core::ops traits to be used in any context/need/vm. I just peek traits what work for me. But To/FromPrimitive are not generic enough, I cannot use to integer vs float primitives. Floats leaks to compilation result as part of format/display/debug routines, which breaks specialized environments. I can use |
Another possible breaking change tbh can be done accopanying any breaking change https://docs.rs/num/latest/num/traits/trait.Zero.html
Also some part of num-traits is already splits float to Closing for now so. Can send PR with gate or split of traits if any will be considered as option. In general I feel that not my specialized needs are kind of things, but that num-traits are not general enough(easy to fix, so breaking change) in the end. |
Problem
Some restricted VMs/hosts/environments:
Does not have floating point numbers implemented and their validators/loaders (of code or compiled binary) complain or/and fail to handle code referencing f64/f32
Solution
The text was updated successfully, but these errors were encountered: