News for hackers. Stuff that matters.
Re:Compile-time safety for enumerations in Go by throwaway894345 on Friday September 29, 2023 @11:22AM (#37705588)
The type conversion is a red herring. He's just changing the value of a variable by referencing and dereferencing a pointer. In other words, he's not using a pointer conversion to change the value of `color.Red`, he's creating a new variable `c` and assigning `color.Red` to it, and then changing the value of the variable through the pointer and type conversion. But he doesn't even need to do the pointer/type conversion stuff, he could just do `c = Color("orange")` and call it a day.
Re:Compile-time safety for enumerations in Go by kiitos on Friday September 29, 2023 @12:09PM (#37706279)
> But he doesn't even need to do the pointer/type conversion stuff, he could just do `c = Color("orange")` and call it a day.

c = Color("orange") does not compile.

Re:Compile-time safety for enumerations in Go by throwaway894345 on Friday September 29, 2023 @03:29PM (#37709046)
Ah, I misunderstood what type color.Red had. My mistake.