News for hackers. Stuff that matters.
Re:EOF is not a character by bloomer on Saturday March 14, 2020 @12:47PM (#22576644)
I would also like to not that encoding the the Option<char> using the unused bits of the return value is a perfectly valid implementation. But that is exactly what it is, an implementation detail. It could work exactly the same way as today but the programmer wouldn’t have to care about how it was implemented, just whether they got a char or None.
Re:EOF is not a character by dmit on Saturday March 14, 2020 @04:44PM (#22578522)
In fact, that's exactly what Rust already does today! Option<char> uses the exact same amount of bits to store as plain char, because the compiler has enough information to encode the Option-ness of char in what it knows is a garbage bit of the underlying type.

https://play.rust-lang.org/?version=stable&mode=debug&editio...

Re:EOF is not a character by steveklabnik on Saturday March 14, 2020 @05:33PM (#22578885)
Rust guarantees this, actually.