Announcing Rust 1.11
blog.rust-lang.org
blog.rust-lang.org
[0]: https://github.com/rust-lang/rust/pull/35764
[1]: https://github.com/rust-lang/rust/issues/34511
[2]: http://manishearth.github.io/blog/2016/08/18/gc-support-in-r...
I was surprised to hear this and immediately thought "but why would you do such a thing!?" but I read the blog post and I'm impressed with the forethought that I certainly lacked. This is freaking genius.
More to the point, though, is 'sin' and 'cos' are also methods, so having 'to_degrees' as a method seems reasonable.
let r = f32::to_radians(5.0);
let x: f32 = 5.0;
let r = x.to_radians(); trait AngleConversion {
fn to_degrees(&self) -> Self;
fn to_radians(&self) -> Self;
}
impl AngleConversion for f32 {
...
}
impl AngleConversion for f64 {
...
}
Operators like + and / already live in traits; why not put methods like these into traits as well, so that users can implement them for their own types (variable-precision floats, decimal floating point, etc)?(As a side note, can a trait accept an AsRef<Self> in place of &self or self, so that register-sized objects implementing Copy don't need to use &self?)
Plus, since you can define your own traits, if this is functionality you need, you can just do it, and delegate to the inherent implementation for those two types.
I agree with the caution though. This takes time to get right.
value.to_radians().to_radians()
then? Weird.That said, this is probably such a simple use that it's not worth having Degree and Radian classes in core.
This sort of stuff works really well when the type system incorporates units of measure directly (usually as some kind of generic type parameter). F# is a good example.
var s1 = "blah"
var s2 = s1 as string
var s3 = s2 as string
edit: Nevermind, I guess you're wanting like types for units of measurement. Sounds interesting.Is the best way to solve that problem by introducing "unit measurement" types that are more specific than general numerical types? Or is there another way? Or even a general concept I can go read about? Thanks in advance!
"With this PR a "hello world" cdylib is 7.2K while the same dylib is 2.4MB, which is some nice size savings!" [1]
1. https://github.com/rust-lang/rust/pull/33553#issue-154141126
The changelog is silent about these two points, so does it mean that -Z orbit defaults to "on" in 1.11 and -Z incremental can be used in 1.11?
As always, I've updated my Docker image: https://hub.docker.com/r/jimmycuadra/rust/ (available on quay.io also if you prefer that)
The tags "latest" and "1.11.0" are now both Rust 1.11.
> When calling sum and a primitive integer type is being returned, this method will panic if the computation overflows.
I thought Rust's strategy for numeric overflow is to panic only in debug mode. Has that strategy changed or is this a special case?
Nice! This one bit me pretty bad when first getting into Rust so it's nice to see it improved.
You can check out the new book here: http://rust-lang.github.io/book/
We're working on the new book because the old book isn't as good as it could be, but that doesn't mean it's bad: a lot of people have told me that they really love it. But I am hyper-critical of my own work, and there's a lot of ways you can improve something that's already good :)
As you can see, the new book isn't really far enough along to fully teach you Rust yet. I would maybe check out the new material first, and then just read the existing book afterwards.
(I'm sure some random strangers thank you doesn't mean much, but it's hard to not notice your work. And i just wanted to make sure i expressed my appreciation.)
No, it helps a lot, and I appreciate it. Thanks.
The majority of pages shouldn't intercept up/down either, because that breaks the ability to scroll the page. Only pages that will never involve scrolling (such as whole-screen web apps or games) should do that.
Left/right can be OK, as long as you never expect your page to need horizontal scrolling.
If you ask me it's better. Assuming you are not new to programming.
So much win.
For example: https://github.com/rust-lang/rust/pull/34096#issuecomment-22...
--HEAD just hangs forever on 'Checking out branch master' for some reason for me.
(I've been using it daily for months and it works well for me)