Live data from Hacker News

Rust: 128 bit integers preparing to be released

github.com

31–40 of 173 posts

Re: Rust: 128 bit integers preparing to be released

#31
post #29

Earlier quoted context omitted.

Why would they? Do you have any idea how much money a vuln like that would be worth? You've threatened to kill people on twitter and you think someone would turn something like that over to the team out of charity? You're delusional. I've never seen a million-dollar exploit, but DAMN if this wouldn't be close.

> You've threatened to kill people on twitter What?

More than once, but the tweets have been deleted.

He's a real slimeball.

Re: Rust: 128 bit integers preparing to be released

#32
post #22
post #15

Earlier quoted context omitted.

GUIDs are usually 128 bits. So are IPv6 addresses. Could be nice to store them in a single, native type? Probably no easier than a byte array though...

Neither one is used like an integer though. As in, you don't really add GUIDs together¹, so there's no real benefit over a byte array or struct. 1. I guess having bit mask operations for IPv6 addresses could be useful.

But you do want to compare GUIDs. And hash them, which can involve shifting, adding, xor'ing, multiplying, remaindering, etc.

Re: Rust: 128 bit integers preparing to be released

#33
post #22
post #15

Earlier quoted context omitted.

GUIDs are usually 128 bits. So are IPv6 addresses. Could be nice to store them in a single, native type? Probably no easier than a byte array though...

Neither one is used like an integer though. As in, you don't really add GUIDs together¹, so there's no real benefit over a byte array or struct. 1. I guess having bit mask operations for IPv6 addresses could be useful.

Avoiding pointers to arrays is nice.

This is the big annoyance in Golang with it's net.IP type - it's `type IP []byte`, which means you can write ip1 == ip2 and you can't pass by value easily, nor use it as a map key.

I've ended up inventing my own type for that a lot of the time as a struct wit static fields, since those you can copy around and do 1:1 comparisons.

Though to be honest I'd be super happy if there was a drop-in varint type, or you could trivially have the compiler calculate instructions for a arbitrary fixed size ints.

Re: Rust: 128 bit integers preparing to be released

#36
post #32
post #22

Earlier quoted context omitted.

Neither one is used like an integer though. As in, you don't really add GUIDs together¹, so there's no real benefit over a byte array or struct. 1. I guess having bit mask operations for IPv6 addresses could be useful.

But you do want to compare GUIDs. And hash them, which can involve shifting, adding, xor'ing, multiplying, remaindering, etc.

If you can't already hash/compare an array of bytes, something terrible has happened with your language design.

Re: Rust: 128 bit integers preparing to be released

#37
post #33
post #22

Earlier quoted context omitted.

Neither one is used like an integer though. As in, you don't really add GUIDs together¹, so there's no real benefit over a byte array or struct. 1. I guess having bit mask operations for IPv6 addresses could be useful.

Avoiding pointers to arrays is nice. This is the big annoyance in Golang with it's net.IP type - it's `type IP []byte`, which means you can write ip1 == ip2 and you can't pass by value easily, nor use it as a map key. I've ended up inventing my own type for that a lot of the time as a struct wit static fields, since those you can copy around and do 1:1 comparisons. Though to be honest I'd be super happy if there was…

Rust offers non-allocating fixed-sized arrays, so a GUID could be a (wrapper around) [u8; 16] and an IPv6 address could be [u16; 8].

Re: Rust: 128 bit integers preparing to be released

#38
post #35

Earlier quoted context omitted.

More than once, but the tweets have been deleted. He's a real slimeball.

Do you have any proof? These seem to be pretty big accusations.

Last time this troll popped up, [1] they claimed that I told people to kill themselves. Which I absolutely do not. Now apparently it's threatening to kill other people, which I most certainly have not.

They claimed that I have deleted said tweets so that people wouldn't see them (which also doesn't make much sense) and that they didn't grab a screenshot (which also wouldn't make sense given that it's easy to edit the HTML of a webpage and take a screenshot.)

So uh, yeah.

1: https://news.ycombinator.com/item?id=12970148

Re: Rust: 128 bit integers preparing to be released

#39

Why was this feature accepted whereas 128 bit floats were removed from Rust?

128 bit floats were removed years ago (June of 2014), here's the meeting notes from the time: https://github.com/rust-lang/meeting-minutes/blob/master/wee... (as with all old Rust stuff, please remember that details very much might have changed between then and now.) In other words, they weren't removed because we fundamentally didn't want them. They were removed because of maintainability, usability, and usefulness…

I wasn't able to find any real justification beyond (a) one vague mention of "some algorithms... such as certain cryptographic algorithms" and (b) the fact that clang supports it. Can you point to something more specific? Justification (b) in particular smells bad to me.

Re: Rust: 128 bit integers preparing to be released

#40
post #3

What sorts of applications/domains need or benefit from having 128 bit integers?

You can store a bitboard for western chess perfectly with 64-bit integers. Some other chess variants(like Chinese Chess, or Shogi) need 128 bits for the same techniques, since the board is larger.

I haven't used it, but Julia lets you declare any(?) fixed size bitset. Which would probably come in handy for Go.

Post reply on HN