News for hackers. Stuff that matters.
Re:Go Contracts – Draft Design by atombender on Tuesday July 30, 2019 @07:06AM (#20563702)
Agreed, though I think the syntax problem (too many parens) could be made more readable and Go-like by emphasizing the generic aspect and making it stand out visually -- leaving no doubt that you're in a section that's generic, and perhaps dissuading overuse by making it noisy. Perhaps something like:

  generic func(T, U) Map(slice []T, mapper func(T) U) []U
For "contracts":

  type Set generic interface(T comparable) {
    Push(T)
    Pop() T
  }
Every time you want to refer to a generic type you'd have to use the generic keyword, which encourages use of concrete types:

  type IntSet generic Set(int)
This is more or less how Modula-3 does it. Generics have dedicated syntax with a "generic" keyword.

There are no comments on this comment yet.