
Closures are the Generics for Go - RabbitmqGuy
https://medium.com/capital-one-developers/closures-are-the-generics-for-go-cb32021fb5b5
======
saghm
It's interesting that they cite DRY as one of the reasons for refactoring the
code to use closures, as it appears that in their later example of sorting,
the two lambdas they pass for sorting ints and strings are identical other
than type. Interestingly, it looks like that repetition could be solved by a
macro that generates the function given a type. I'm not surprised super
familiar with Go; I'm guessing that it doesn't have any sort of macro system
that could do this, or else they would have mentioned it?

~~~
saghm
Oops, meant to say "I'm not super familiar"; my phone must have autocompleted
"surprised" without me realizing, and now it's too late to edit

------
lloydjatkinson
If I had to choose between no generics or "generics as closures" I'd vote no
generics.

