4 ms·
Most programs do list manipulation and list manipulation in Go is a pain. Generics are one solution for that.
by Touche 12y ago
Most programs do list manipulation and list manipulation in Go is a pain. Generics are one solution for that.
- nonuby 12y agoI agree generic would be a serious win for Golang. However in the meantime we have this workaround/hack which alleviates some of the pain http://clipperhouse.github.io/gen/ http://clipperhouse.github.io/gen/
- mwsherman 12y agoAppreciate the mention! Also gen is getting more, um, generic with the notion of custom ‘typewriters’, out on this branch: https://github.com/clipperhouse/gen/tree/3.0 https://github.com/clipperhouse/gen/tree/3.0
- logicchains 12y agoLisp manipulation? Do you mean linked lists, or arraylists? The only common use of linked lists I've encountered is writing custom allocators, and most programs don't need custom allocators.
- deleted 12y ago[deleted]
- _ak 12y agololwhat? How exactly would list manipulations in Go be made easier because of generics?
- TheCoelacanth 12y agoHow many of these[1] functions can I write in Go without doing a bunch of casting? Probably less than half. [1] https://hackage.haskell.org/package/base-4.7.0.0/docs/Data-List.html https://hackage.haskell.org/package/base-4.7.0.0/docs/Data-L...
- personZ 12y agoGo "lists" are type dynamic -- "generics" in the most important place for generics to be.
- steveklabnik 12y agoHeterogeneous lists are not "generics."
- personZ 12y agoA Go map is of the defintion map[KeyType]ValueType. A Go slice and dynamic array is similar typed. That isn't heterogeneous, it isn't of type object, and is 99% of the common use of generics. Yeah, the native fundamental collections are generic.
- steveklabnik 12y agoI have a feeling we're talking about different things: when people speak about Go generics, they mean that the language doesn't support parametric polymorphism. Yes, some of the built-in types are special. That's not the point.