News for hackers. Stuff that matters.
Re:Rust Is the Future of JavaScript Infrastructure by tialaramex on Thursday November 11, 2021 @06:35PM (#29194656)
I was surprised that I was OK with that fact that in Rust a vector and an array with the same elements compare equal. It felt completely reasonable, and I definitely didn't feel that way about it in some other languages where that's true.
Re:Rust Is the Future of JavaScript Infrastructure by bsder on Friday November 12, 2021 @02:47AM (#29197172)
Erm, no, that doesn't work. I created a quick check in the Rust Playground: https://play.rust-lang.org/?version=stable&mode=debug&editio...

Do you have some more context? I suspect somehow things are getting coerced to slices and then compared.

Re:Rust Is the Future of JavaScript Infrastructure by Measter on Friday November 12, 2021 @07:07AM (#29198507)
The implementation isn't symmetric, it'll work if you compare `b == a`. Apparently[0] it's something to do with avoiding code bloat.

[0] https://github.com/rust-lang/rust/blob/e4c23daeb461ac02413eb...