6 ms·
My guess is this was written as a joke. It's rust, so the person writing this has to have some programming knowledge.
by growt 5y ago
My guess is this was written as a joke. It's rust, so the person writing this has to have some programming knowledge.
- codesections 5y ago"some programming knowledge" ≠ "knowledge of bit operators" Imo, Rust makes a very good second language for someone who first learned Javascript or Ruby — and someone who used those languages primarily for web dev may never have needed to learn about bit shifts
- afandian 5y agoI find it hard to believe that someone simultaneously doesn't know the first thing about bit operations, but has come to the conclusion that they need to find the first 42 bits. Also, JavaScript's handling of numbers is so weird that it's one of those things that comes up just by virtue of its weirdness. For that reason I'd expect a JS programmer at least have come across but operations. (edit - I take the original post as a joke too, and that the humour is derived from the juxtaposition)
- mdip 5y agoBoth very good points -- I hadn't originally assumed it was a joke, mostly because I don't write `rust` code and I don't know how unlikely it would be to come to that solution. I know I've seen examples at least as odd as this in the past in languages I'm familiar with -- where, say, the developer was really good with LINQ or something and made five calls instead of just accessing an array by index -- that were meant "intentionally", but were bizarre to someone not sitting in their brain at that moment. I hadn't, however, thought about either of the points you mentioned. You're quite the detective. :)
- voidnullnil 5y agoMost JS programmers are utterly unaware of how their "numbers" work.
- pavon 5y agoLooking at the most recent stackoverflow developer survey[1], most of the developers expressing interest in Rust would be moving from high level languages like Javascript and Python. It doesn't surprise me that developers with that background wouldn't be aware of systems programming concepts like bitshifts. I've seen similar code in Java (convert to boolean array, move bits down, convert back to integer) that was written in earnest. [1] https://insights.stackoverflow.com/survey/2021#section-worked-with-vs-want-to-work-with-programming-scripting-and-markup-languages https://insights.stackoverflow.com/survey/2021#section-worke...