Reflection and meta programming
Mat, Jon, and Jaana discuss reflection and meta programming. How do other languages use reflection, and how does that differ from Go’s approach? What libraries are using reflection well? What are some examples of bad times to use reflect? What alternative approaches exist? And what are those weird struct tags I keep seeing in Go code?
Changelog++ members support our work, get closer to the metal, and make the ads disappear. Join today!
Sponsors:
- DigitalOcean – DigitalOcean’s developer cloud makes it simple to launch in the cloud and scale up as you grow. They have an intuitive control panel, predictable pricing, team accounts, worldwide availability with a 99.99% uptime SLA, and 24/7/365 world-class support to back that up. Get your $100 credit at do.co/changelog.
- Gophercises – Gophercises is a free course that will help you become more familiar with Go while developing your skills as a programmer. The course consists of 20 different mini-applications, packages, and tools that are each designed to teach you something unique about Go. Get started at gophercises.com/gotime
- Fastly – Our bandwidth partner. Fastly powers fast, secure, and scalable digital experiences. Move beyond your content delivery network to their powerful edge cloud platform. Learn more at fastly.com.
- Rollbar – We move fast and fix things because of Rollbar. Resolve errors in minutes. Deploy with confidence. Learn more at rollbar.com/changelog.
Featuring:
- Mat Ryer – Twitter, GitHub, LinkedIn, Website
- Jon Calhoun – Twitter, GitHub, Website
- Jaana Dogan – Twitter, GitHub, Website
Show Notes:
- Laws of Reflection - From the Go blog
- Oto - Library by Mat using AST to generate code
- form - Jon’s form library that uses reflect
- form’s without reflect - An example from Jon of creating forms without reflect
- Language Server Protocol - Created by Microsoft to make it easier to create autocompletion for different editors
- A new Go API for Protocol Buffers - A writeup of changes in protobuf to allow for a type of reflection
Something missing or broken? PRs welcome!