Thoughts about programming.

  • A walkthrough of type constraints in Go

    Generics let you write data structures and functions with types that are specified later. Functions and types can have type parameters, and instantiated with type arguments, at compile time. Because this occurs at compile time, type parameters — have type constraints. Type constraints restrict the set of allowed type arguments.

    April 23, 2022
  • Adapting Go packages to use generics

    How do you change a package that uses strings to generic types? Like many I have packages that work with a single type — but solve a general problem. In this article we look at how convert these to use generics.

    March 21, 2022