• Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    5
    ·
    8 months ago

    So, I don’t code in Go and have no intention to. But my impression was that Go is intentionally simplistic. Now I read about this iota keyword, which seems like such a niche thing to include into the language, like what the heck. Is there any other use for it, aside from creating pseudo-enums?

    • Nope. Of all the silly things to include in an intentionally pared-down language, iota is maybe the dumbest thing in the language. I think the purpose was to provide a default value, because one of the things that was talked up when the language was young was how every variable had a default value - there were no undefined values for any types. But honestly, I don’t know; it seems a waste.

      And I say this as someone who still hasn’t personally found a better language than Go, except maybe C99. The language has warts, but at least - unlike a commonly compared and currently popular language - it doesn’t look like it fell out of the ugly tree and hit every branch on the way down. And I believe Go’s remaining warts will be resolved, eventually.

      • Ephera@lemmy.ml
        link
        fedilink
        arrow-up
        3
        ·
        8 months ago

        Well, if you’re talking about Rust there, then seeing Go’s pseudo-enums had me even more confused, why anyone’s comparing the two.
        Rust not only has enums, they’re used everywhere and when combined with pattern matching, they’re one of the most powerful concepts in the language…