Here&#x27;s one way you could do the clipping generically in Go[1]. This has a Clip function that uses a type assertion. Another (perhaps better) implementation would add Clip methods to both Rect and Poly.<p>Either way, I don&#x27;t think this example proves the necessity of generics. Some algorithms are certainly more difficult to express in Go (graph data structures&#x2F;algorithms in particular in my personal experience).<p>[1]: <a href="https:&#x2F;&#x2F;play.golang.org&#x2F;p&#x2F;xYQWDS41A0" rel="nofollow">https:&#x2F;&#x2F;play.golang.org&#x2F;p&#x2F;xYQWDS41A0</a>