Re:Maybe adding generics to Go is about syntax after all
by gregwebs on Tuesday September 04, 2018 @11:15AM
(#17909590)
This might be nice to use in the specific case. However, its important to note that in the general case, you need a type variable because it is used in multiple positions. In the function below (taken from the proposal), one is stating that T is the same type in all usages.
This below version is different, each variable could be a different type (that satisfies strseq).
[ Parent
| on HN ]
Re:Maybe adding generics to Go is about syntax after all
by mopsy on Tuesday September 04, 2018 @12:17PM
(#17910129)
As I understand, the type would be implicitly applied to every func/struc in scope (which I assume would be the package)
It work quite well for package like a Map so any data structure/algorithm. I suspect it would be less ideal for filter/map/reduce.