News for hackers. Stuff that matters.
Re:Compile-time safety for enumerations in Go by Nullabillity on Friday September 29, 2023 @08:24PM (#37711715)
By the same token, Rust has no type safety because std::mem::transmute exists. In practice, it's not a problem because transmute is not a valid way to construct or interact with values (outside of a few special cases). By calling transmute you're explicitly opting out of all safety and abstraction, and entering here-be-dragons territory.

(That said, the Go syntax looks far less "scary" than `unsafe { transmute::<_, Colour>("orange") }`, which I'd definitely call a design issue.)

Re:Compile-time safety for enumerations in Go by kiitos on Friday September 29, 2023 @08:47PM (#37711831)
The code in my example is an entirely valid way to interact with values, and doesn't represent an "opting out" of safety or abstraction.