First class functions are a lot less interesting without functional data structures, with methods like map, filter, reduce, etc. These were added in Java 8, but Go has always been against them. This may change with generics, people can certainly write their own now, but I’m on the fence about whether they’ll catch on. I think they still won’t be overly nice to use in Go because:
- Go’s lambdas are extremely verbose. “Concise but clear” is a big part of what people live about functional data structures, Go won’t have the concise part
- Go will still have almost no support for immutability, which works beautifully with functional data structures
- Go’s lambdas are extremely verbose. “Concise but clear” is a big part of what people live about functional data structures, Go won’t have the concise part
- Go will still have almost no support for immutability, which works beautifully with functional data structures
Code like this is nice to write:
users.map((user) => user.id)
While code like this isn’t:
users.map(func (user User) string { return user.id })