Re: [go-nuts] Iota with string constants

2017-10-16 Thread Josh Humphries
Comparing values will be a lot cheaper with ints than strings. So if your enum type is possibly used in hot loops, ints will be your friend. Also, with ints, you can provide an ordering that differs from the lexical order of the string values. For example, with an int, you can easily sort by day-of

[go-nuts] Iota with string constants

2017-10-15 Thread m
Is it anything wrong just assigning string values to get rid of String() method attaching? *Like this:* type Weekday string const ( Sunday Weekday = "Sunday" Monday Weekday = "Monday" ) func main() { fmt.Println(Sunday) } *Instead of this:* type weekday uint const ( Sunday weekday