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

Comparison traits for wide types not accessible on API #132

Open
dooost opened this issue Jul 10, 2021 · 3 comments
Open

Comparison traits for wide types not accessible on API #132

dooost opened this issue Jul 10, 2021 · 3 comments

Comments

@dooost
Copy link

dooost commented Jul 10, 2021

Currently the comparison traits CmpEq, CmpGt, CmpGe, CmpNe, CmpLt, CmpLe are not exported from the crate, which makes dealing with wide types inconvenient.

It's possible to add wide as a separate dependency and import the comparison traits, which is far from ideal. Considering the wide float types are re-exported from ultraviolet and are rather crucial to effectively using uv's own wide types, I think these traits should also be re-exported on ultraviolet's API.

Use of cmp_gt is also mentioned in the Ray-Sphere Intersection example on README.

@dooost
Copy link
Author

dooost commented Jul 10, 2021

If you don't see any concerns with this, I'd be more than happy to open a PR :)

@fu5ha
Copy link
Owner

fu5ha commented Jul 11, 2021

Yeah these should probably be re-exported. Maybe in a prelude module or something, PR welcome :)

@dooost
Copy link
Author

dooost commented Jul 13, 2021

I had some time to have a look at this, and I'm having a bit of a hard time settling on a suitable module for these traits. Sorry in advance for the long-ish post, I'm fairly new to Rust and not super familiar yet with project structure common practices. :)
I think prelude kinda implies that use ultraviolet::prelude::* should give you a list of types and traits that would be used in majority of projects that use ultraviolet, but I'm not sure that's the case with these traits or f32x4/8. I would expect prelude to contain some vector and matrix types as well and generally the types you use most when using ultraviolet, but I think ultimately this would be a bigger and more complicated question, how should such a list can be curated so that wouldn't result in too many redundant imports when using use ultraviolet::prelude::*.
I considered a comparison module which felt a bit awkward as I'm not sure if there's anything else that could go there besides these traits.
Another idea was to create a wide module that would re-export f32x4/8 and also the comparison traits, but it might be misleading if the wide module do not contain the wide vector/matrix types. But I can see scenarios in which such a module would be useful, if it does include the wide vec/mat types too - however that would be a bigger re-structure and I'm not sure if that makes sense with the bigger picture of your plans for this crate.
Besides these, the simplest way of course would be to re-export these publicly from the crate root. (curently they're re-exported but with pub(crate)). While maybe not the most elegant solution, I can't really think of any downsides to this.

I'm wondering, what would you think would be the best course of action here?

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