←back to thread

361 points mmphosis | 1 comments | | HN request time: 0s | source
Show context
vander_elst ◴[] No.42165926[source]
> It's better to have some wonky parameterization than it is to have multiple implementations of nearly the same thing. Improving the parameters will be easier than to consolidate four different implementations if this situation comes up again.

From https://go-proverbs.github.io/: A little copying is better than a little dependency.

Curious to see how the community is divided on this, I think I'm more leaning towards the single implementation side.

replies(4): >>42165963 #>>42166107 #>>42166264 #>>42169200 #
1. brigandish ◴[] No.42169200[source]
I was going to disagree with this because I thought "but what about the tests!", but in the linked video of Rob Pike's talk he says (paraphrased) "but then of course there's a test, so that every time it is tested, it guarantees that the library and the copied code agree on their definition. The test has a library dependency but the copied code doesn't".

That's actually a really clever way to do things and I think I'll adopt it.