Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have a deep hatred of Go for all the things it doesn't have, including a usable type system (if I cannot write SomeClass<T where T extends HorsePlay> or similiar, the type system is not usable for me).

For NodeJS development, you would typically write it in Typescript - which has a very good type system.

Personally I have also written serverside C# code, which is a very nice experience these days. C# is a big language these days though.



FYI, newer versions of Go do support the following

  type HorsePlay interface {
   Neigh()
  }
  
  type SomeClass[T HorsePlay] struct {
   players []T
  }
  
  func (sc SomeClass[T]) NeighAll() {
   for _, p := range sc.players {
    p.Neigh()
   }
  }
  
  type Horse struct{}
  
  func (h Horse) Neigh() {
   fmt.Println("neigh!")
  }
  
  func main() {
   sc := SomeClass[Horse]{players: []Horse{{}, {}, {}}}
   sc.NeighAll()
  }




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: