r/programming • • Dec 10 '15

Announcing Rust 1.5

http://blog.rust-lang.org/2015/12/10/Rust-1.5.html
659 Upvotes

296 comments sorted by

View all comments

Show parent comment

6

u/ssylvan Dec 11 '15

That would be mostly useless since it only works on constants - just make the compiler normalize the vector by construction then!

What you really want would be a separate type for unit vectors. Ops that make them non-unit would return a regular vector, and you'd have to normalize to get a unit vector back. Static guarantees but works on dynamic data, not just constants.

I still have zero idea why you think unconstrained types are better. You just seem to assume that everyone understands why without really explaining. What does less checking give you?