Intertype: type analysis for annotated empty interface{}s

What type would you set for a variable that can be either an int or a float64? In this talk I will talk about the empty interface in Go. We will look into why we need the empty interface type and how it is used.

Abstract

What type would you set for a variable that can be either an int or a float64? In this talk I will talk about the empty interface in Go. We will look into why we need the empty interface type and how it is used. One common (mis)usage of the empty interface is to implement sum types (a variable that have multiple possible types, for example, a variable that is either an int or a float64). I will describe an approach for implementing sum types in Go without the empty interface! And finally, I will demo Intertype, which is an experimental type checker for annotated empty interfaces. I will show how we could add type constraints for the dynamic types of an empty interface in our own code and for our dependencies.

Video

GoLab is a conference made by Develer.
Develer is a company based in Campi Bisenzio, near Florence. Our motto is : "Technology to give life to your products". We produce hardware and software to create exceptional products and to improve industrial processes and people's well being.
In Develer we have passion for the new technologies and we offer our clients effective solutions that are also efficient, simple and safe for the end users. We also believe in a friendly and welcoming environment where anybody can give their contribution. This passion and this vision are what we've been driven to organize our conference "made by developers for developers".


Subscribe to our newsletter

We hate spam just as much as you do, which is why we promise to only send you relevant communications. We respect your privacy and will never share your information with third parties.
©2024 GoLab | The international conference on Go in Florence-Design & devCantiere Creativo-Made withDatoCMS