New features for Go

5 Jun

Below are the features I think would be really cool to add to Go.

1. User can re-define operators like +, >, .. for a struct

2. Support list comprehension: x = [e for e in y if e > 0]

3. Support shorthand function definition, like scala:  (x: Double) => x * x

4. Support type inference or pattern match for functions. For example, suppose method X accepts a func (x, y int) as one of its parameters, we can call it this way:

a.X(func (x, y) { ….}, …), i.e. without specifying the types of the parameters x and y in the anonymous function — they are automatically inferred.

5. generic

%d bloggers like this: