Post AliwJFhJFuFR2Dn3FA by gregorni@fosstodon.org
(DIR) More posts by gregorni@fosstodon.org
(DIR) Post #AliwJFhJFuFR2Dn3FA by gregorni@fosstodon.org
2024-09-05T21:39:46Z
0 likes, 0 repeats
Name one programming language feature you like and one you dislike.It can be anything from zero-based indexing to garbage collection to recursion.#Programming
(DIR) Post #AliwJGY85WUzg2VEZc by timokoesters@mastodon.social
2024-09-06T10:01:07Z
1 likes, 0 repeats
@gregorni ❤️ Enums where variants can have associated data💔 In Rust, the "as" keyword does bit-truncating instead of saturating or panicking (e.g. 257_i32 as u8 = 1 instead of 255 or panic)
(DIR) Post #AliwLpyXLX667z54JE by gregorni@fosstodon.org
2024-09-06T10:15:48Z
0 likes, 0 repeats
@timokoesters I've never run into the bit-truncating problem, but that does seem like something that would cause you a headache. Also, yes, variants with associated data are just 🤌🤌
(DIR) Post #AliwLqoIF6UuiVIOyu by timokoesters@mastodon.social
2024-09-06T10:27:38Z
0 likes, 0 repeats
@gregorni I wanted to convert an int so that it just saturates at both ends. The shortest way I figured out was "x as f32 as u8" which is really odd.