Type constructors
kvark opened this issue · 5 comments
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
.
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.
Not sure if this is the correct issue to ask on: but are there plans to add From<(T, T)>
for Point2
and Vector2
?
@rep-nop we haven't considered that yet. What would be the use case?
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.
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?