• space_comrade [he/him]@hexbear.net
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Go sacrifices too much for superficial simplicity; but I would like to see a language that’s nearly as easy to learn, but has a better type system and fewer footguns.

    “Easy to learn” and “good type system” will by necessity be opposing forces IMO. If you want to work with a good type system you’re gonna have to put in the effort, I’m not sure there’s this magical formulation of a good type system that’s also intuitive for most new developers. Hope to be proven wrong one day tho but so far no dice.

    • BatmanAoD@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      I think TypeScript has a pretty good type system, and it’s not too hard to learn. Adding sum types (i.e. enums or tagged unions) to Go would be a huge improvement without making it much harder to learn. I also think that requiring nullability to be annotated (like for primitives in C#, but for everything) would be a good feature for a simple type system. (Of course that idea isn’t compatible with Go for various reasons.)

      I also think that even before “proper” generics were added, Go should have provided the ability to represent and interact with “a slice (or map) of some type” in some way other than just interface{}. This would have needed dedicated syntax, but since slice and map are the only container types and already have special syntax, I don’t think it would have been that bad.