a thoughtful web.
Good ideas and conversation. No ads, no tracking.   Login or Take a Tour!
comment by rob05c
rob05c  ·  3505 days ago  ·  link  ·    ·  parent  ·  post: Go Is Unapologetically Flawed, Here’s Why We Use It

Specifically, lack of macros. Though Go's reflection and other metaprogramming paradigms also suck.

I had a pattern that was repeated everywhere involving both a continue and a return. Which is impossible to convert to a function; it has to be a compile-time macro. Which Go doesn't have. I put as much as I could in a function, but it still ended up being about 6 duplicate lines, repeated everywhere, which were literally impossible to abstract.

That said, that was before Go added go generate. I've yet to play with go generate, but I think I could use it to abstract the duplicate block. Though it's a pretty ugly way of doing it.