5min chapter

Changelog Master Feed cover image

What's new in Go 1.20 (Go Time #267)

Changelog Master Feed

CHAPTER

What's the Deal With Comparative Types in Go?

In the Go spec, there's this idea of comparable types and then types that are not comparable. A comparable type is like if you have two strings, you can say string X equals string Y or string X does not equal string Y. There are things that are not similar in Go such as slices being different areas in memory. You're just not allowed to compare slices to each other. That's the only legal comparison you can make. And so for interface types, this gets a little bit weird. If you want to say X equal to Y and X and Y are both some interface type, you can do that even if the concrete type underneath the interface is something that wouldn't normally be

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode