Re:The Smallest Thing in Go
by unsnap_biceps on Tuesday December 10, 2024 @03:41AM
(#42375017)
Does B == 'B' in your example?
Re:The Smallest Thing in Go
by plorkyeran on Tuesday December 10, 2024 @11:35PM
(#42384826)
Yes, C enums increment by one for each case if no value is specified.
Oh c'mon, that's a cheap shot. Your example is odd, as it doesn't really show off anything interesting; I can indeed write it as a C enum, and I can do it with less typing:
iota doesn't really do anything interesting there. Much more interesting, IMO, was the example in the article where it can be used to easily construct bitfields. That shows off the "just about any static math expression" that you point out.I think my problem with it overall is that it's weird and unexpected. Even when it can be genuinely useful, it doesn't really fit in the language as a part of syntax. Then again, I feel like that's pretty common for Go.