News for hackers. Stuff that matters.
Re:Impressions of Go by catenate on Tuesday July 23, 2013 @12:57PM (#6091268)
I'd like to use map/fold/filter idioms instead of for loops, because this encourages me to write reusable functions instead of embedded blocks of code. To do this in Go, I need to write type-specific functions for every combination of passed function, source collection, and return-collection type. The alternatives I see in Go are to lose type checking or to fumble around with introspection and casts.
Re:Impressions of Go by jbooth on Tuesday July 23, 2013 @01:08PM (#6091355)
That sounds like it's actually a complaint about strong typing -- if everything's the same type, you can do that now by passing around first class functions.
Re:Impressions of Go by tmhedberg on Tuesday July 23, 2013 @01:22PM (#6091463)
There are plenty of strongly, statically typed languages which do not have this problem because they have parametric polymorphism, i.e. generics.
Re:Impressions of Go by pcwalton on Tuesday July 23, 2013 @01:21PM (#6091452)
Reread the comment. It's a complaint about the lack of generics.
Re:Impressions of Go by catenate on Tuesday July 23, 2013 @03:07PM (#6092229)
Aka polymorphic function parameters. If I manage to abstract a bit of functionality into a function, I don't care what the type is as long as the operations within the function work on it. Haskell uses typeclasses to provide this guarantee for specific types. Go seems to try to do something like this with interfaces, but it doesn't seem to apply to the map/fold/filter style of programming