TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

What’s New in Go 1.21 – A Comprehensive Notes

2 pointsby lycopodiopsidaalmost 2 years ago

1 comment

ernst_klimalmost 2 years ago
&gt; New cmp Package for Comparing Ordered Values<p><a href="https:&#x2F;&#x2F;pkg.go.dev&#x2F;cmp@master" rel="nofollow noreferrer">https:&#x2F;&#x2F;pkg.go.dev&#x2F;cmp@master</a><p>I find this part of the type constraint design particularly lame. Here one can&#x27;t extend the constraint over an arbitrary type, making the cmp.Ordered pretty useless. And that seems like a severe language limitations since one can&#x27;t implement a constrain of a kind:<p><pre><code> interface Comparable { compare(that Self) int &#x2F;&#x2F; where Self typevar is bound to the callee&#x27;s type } func sort[T Comparable](slice ~[]T) ~[]T</code></pre>