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

Type constructors #12

Open
kvark opened this issue Jun 9, 2017 · 5 comments
Open

Type constructors #12

kvark opened this issue Jun 9, 2017 · 5 comments
Labels

Comments

@kvark
Copy link
Owner

kvark commented Jun 9, 2017

Writing down mint::Vector3::new(x,y,z) can be often replaced with [x,y,z].into(), but the former is more familiar to many and somewhat clearer. Problem with that is - introducing methods, where currently there is none. We may decide to only allow simple constructors, like new.

@kvark kvark added the question label Jun 9, 2017
@Ralith
Copy link
Contributor

Ralith commented Jun 9, 2017

I still feel that mint shouldn't be making any effort to handle this type of use. If hand-constructed values absolutely must be provided to some interface, and [x,y,z].into() is deemed inappropriate, na::Vector3::new(x,y,z).into() (or whatever) works fine too.

@repnop
Copy link

repnop commented Jun 25, 2018

Not sure if this is the correct issue to ask on: but are there plans to add From<(T, T)> for Point2 and Vector2?

@kvark
Copy link
Owner Author

kvark commented Jun 26, 2018

@rep-nop we haven't considered that yet. What would be the use case?

@repnop
Copy link

repnop commented Jun 26, 2018

Same as From<[T; 2]>, really. Anecdotally, I've seen more people use the tuple syntax for x, y coordinate-type values than the array syntax.

@kvark
Copy link
Owner Author

kvark commented Jun 27, 2018

I believe the main reason for (x, y) as of yesterday is that it's easier to move things out as well as pattern match. The latter is somewhat addressed by the new slice patterns. Would you have some existing code to demonstrate the heavy use of tuples for vectors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants