-
Notifications
You must be signed in to change notification settings - Fork 46
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
Make CoordinateType an "alias" to CoordFloat #110
base: main
Are you sure you want to change the base?
Conversation
Migrate `CoordinateType: Float + Copy + PartialOrd + Debug` to `CoordinateType: CoordFloat`. TBD: Does it make sense to get rid of `CoordinateType` outright, and replace it with CoordFloat? This simplifies usage of proj in other geo libs by making trait requirements consistent. The old requirement of `Float + Copy + PartialOrd + Debug` is now expanded to `Float + Num + Copy + NumCast + PartialOrd + Debug`, plus it fully moves the management of this type upstream to geo-types - so once `Default` is added to geo-types, it becomes transparently added to proj as well.
Feature based type definition doesn't seem good. It could lead to confusion if the feature is enabled by some dependencies and not explicitly by the user. Is there a particular functional advantage to this? |
@rmanoka initially i was not even aware that the The main goal is to implement georust/geo#742 P.S. Technically all this could work even without relying on the centrally defined types, but that would require constantly maintaining CoordFloat definition in two places (like it was done before). Not ideal, but doable. |
This is an alternative, simpler take on georust#110 Adding default constraint allows georust/geo#751
I created an alternative PR to this problem -- #111 |
By feature-based trait defn., I mean that the definition of the trait is changing depending on the features that are enabled. Since cargo accumulates all the features enabled across dependencies, the geo-types feature might be enabled on proj even though the user did not explicitly enable it in the top-level Cargo.toml. We need to ensure that this will not be cause any suprises (eg. a compilation error because some type that would have been Note that both this, and the similar changes in geo repo are technically breaking changes. We should document these in the change-log. Typically, breaking changes that are somewhat of a cosmetic nature (as opposed to adding support for a concrete use-case) are more subjective to review as we'll need to reason about what this would for a possible future use-case. For instance, is it reasonable to imagine a Turning this around, why is it important to add |
Thanks for the explanation, I wasn't aware of aggregate nature of the features.
I suspect you meant some other lib, not lin_alg :). Looking at a big linear alg matrix multiplication code, I see they only require absolute minimum, individually tailored to each feature (i.e. creating matrix has different T constraint from multiplying a matrix). I think this is an interesting approach, but not sure if it will work with geo due to a larger number of moving parts (separate crates, multilevel data, etc).
Always a good point, and it did make me rethink it. Defaults were discussed and implemented a while back, but they were done as an impl on |
Migrate
CoordinateType: Float + Copy + PartialOrd + Debug
toCoordinateType: CoordFloat
.TBD: Does it make sense to get rid of
CoordinateType
outright, and replace it with CoordFloat?This simplifies usage of proj in other geo libs by making trait requirements consistent. The old requirement of
Float + Copy + PartialOrd + Debug
is now expanded toFloat + Num + Copy + NumCast + PartialOrd + Debug
, plus it fully moves the management of this type upstream to geo-types - so onceDefault
is added to geo-types, it becomes transparently added to proj as well.See also georust/geo#746 to simplify such cases
This PR+Release is required for georust/geo#751