3 ms·
I really like this example, because it highlights both the strengths and weaknesses of Go in the same example. On the one hand: Good language support for a spe
by shadowgovt 6y ago
I really like this example, because it highlights both the strengths and weaknesses of Go in the same example.
On the one hand: Good language support for a specialized type and a method on that type, without making the type a heavyweight class (i.e. all that magic can happen at compile-time; Genre can still be an int "under the hood").
On the other hand: wow, that's a lot of boilerplate to write just to get the string representation of a token the compiler already knows about. As other commenters have noted, `go generate` will decrease the amount of code that needs to be hand-written, but it still smells like something the language should handle without explicit code.