Live data from Hacker News

Announcing Rust 1.20

blog.rust-lang.org

271–277 of 277 posts

Re: Announcing Rust 1.20

#271

And here I am, still waiting for the second edition of that book on learning Rust to be finished. I want to learn Rust for fun and I know I should probably just start on reading the book, but I keep making up excuses not to. I want my ++, --, ?:, SIMD, etc.

We had some delays, but things should wrap up on the book soon!

++, --, and ?: are not happening, but SIMD is actively being worked on!

Re: Announcing Rust 1.20

#272

Earlier quoted context omitted.

In Haskell it is easy, you can not create cyclic data structures ;-)

Cyclic data structures can be created in Haskell, in large part due to laziness.

If you see data structures as cyclic, it is not "in large part due to laziness", but _only_ due to laziness. If you look at the memory representation I think (but I am not sure) there will be no cycles between allocated objects. Only a thunk.

Using strict data types, I think you agree that cycles can not be created. Non strict data structures I agree can be seen as cyclic, but I prefer seeing them as infinite.

Re: Announcing Rust 1.20

#273

And here I am, still waiting for the second edition of that book on learning Rust to be finished. I want to learn Rust for fun and I know I should probably just start on reading the book, but I keep making up excuses not to. I want my ++, --, ?:, SIMD, etc.

you've got `let x = if y {100} else {99};`, which IMO is more readable than `let x = y ? 100 : 99`.

Re: Announcing Rust 1.20

#276
post #269
post #236

Earlier quoted context omitted.

Wouldn't that be two parallel vectors? (Side note: nobody ever thinks to bring up cache behavior in interviews where I ask about how a hash map could be implemented - it's nice to know that the library writers care :) ) How does that special hash marker work? What happens when something actually hashes to it? Just silently increment the hash?

> Wouldn't that be two parallel vectors? Yes, but it's a single contiguous memory allocation. (It used to be three parallel vectors in a single allocation, with keys and values also kept separate to avoid padding between them, but experiments showed that had worse cache behavior.) > How does that special hash marker work? What happens when something actually hashes to it? Just silently increment the hash? Looking at…

Oh, clever. Of course you can do it that way.

Re: Announcing Rust 1.20

#277
post #109

So are these associations (functions and constants) just using the object type as a name space? Or is there something more to it?

In the most basic sense you can view it like that. When combined with the typical behavior of traits it gets more interesting. Say you have some data: struct Foo; Then we can make a trait, that defines an interface that we can give to data later: trait Bar { const BAR_CONSTANT: i32; fn some_function(); fn some_method(self); } Then we can actually implement that trait for our data: impl Bar for Foo { const BAR_CONSTAN…

Thanks for the nice example. I've heard of traits but hadn't read enough to know what they are. Looks like a form of multiple inheritance. The example you gave shows polymorphism via traits. That was helpful to me.
Post reply on HN