World Congress 2022 Jun 15, 2022

Go Generics

Nils Kasseckert

Are you sacrificing compile-time safety for generic flexibility? Master Go 1.18 type constraints to reduce repetitive boilerplate without losing robust validation.

Pause
Mute Enter Fullscreen
#1 about 2 min

Introduction to generic programming in modern Go

Writing type-independent code relies on newly introduced parameters, sets, and inference features.

#2 about 4 min

Defining and using type parameters in functions

Declaring type parameters in square brackets eliminates the need to duplicate functions for different data types.

#3 about 3 min

Implementing type constraints to restrict parameter types

Applying prefabricated constraints successfully restricts generic functions to specific data types while preserving compile-time validation.

#4 about 3 min

Understanding interfaces as type sets representing underlying types

Reconceptualizing interfaces as collections of types enables broader compatibility for custom underlying structures.

#5 about 4 min

Utilizing the tilde symbol and nested type constraints

Applying the tilde symbol and nested constraints effectively defines custom collection boundaries alongside the any alias.

#6 about 3 min

Applying function argument type inference in generics

Relying on compiler inference allows developers to omit explicit type arguments during standard function calls.

#7 about 4 min

Leveraging constraint type inference for complex parameter relationships

Resolving complex parameter dependencies relies on constraint type inference to deduce precise structural relationships from interconnected interfaces.

#8 about 4 min

Practical examples and limitations of the any constraint

Implementing marker interfaces effectively resolves compile-time safety limitations when building generic struct loaders with the any alias.

#9 about 2 min

Summary of generics and Q&A on type safety

Balancing generic implementations involves understanding core language mechanics alongside structural trade-offs regarding compile-time type safety.

Matching moments

4:27 min

Introduction to TypeScript generics for type safety

Miroslav Jonaš · LIVE

3:57 min

Multi paradigm language design principles in Go

Frank Müller · World Congress 2021

2:28 min

Adding strong type checking and generic programming concepts

Bjarne Stroustrup · World Congress 2022

1:33 min

Abstracting variables through functional generics and explicit literal strings

Jens Claes · World Congress 2023

4:26 min

Navigating trait discovery and compiler error limitations

Stefan Baumgartner · LIVE

1:40 min

Introduction to the speaker and software development philosophy

Aliaksandr Valialkin Aliaksandr Valialkin · World Congress 2026 Europe

Upcoming sessions on this topic

Open session

World Congress 2026 North America

September 24, 2026 · 16:10–16:40

Outdoor Stage

When Humans Stop Writing Code: Rethinking Languages, Compilers, and Responsibility

Simon Auer

Organizer of flutter vienna meetup and CEO of marqably

Simon Auer
Open session

World Congress 2026 North America

September 23, 2026 · 10:00–17:00

Stage 11

Building Stuff with GenAI - The Open Minded Workshop beyond OpenAI

Andreas Erben

CTO for Applied AI and Metaverse at daenet

Andreas Erben
Open session

World Congress 2026 North America

September 25, 2026 · 09:40–10:10

Stage 5

Vibe Coding Accessibility

Karl Groves

Focused on actively fixing accessibility

Karl Groves
Open session

World Congress 2026 North America

September 24, 2026 · 16:50–17:20

Stage 3

Merging at Scale: From Broken Builds to Green Mainline

Manjari Akella, Preetam Dwivedi

Manjari Akella
Preetam Dwivedi
Open session

World Congress 2026 North America

September 25, 2026 · 12:55–13:25

Stage 7

The spectrum of agentic coding: From vibe coding to high-quality software engineering

YK Sugi

Developer Experience Manager at Eventual

YK Sugi
Open session

World Congress 2026 North America

September 25, 2026 · 14:10–14:40

Stage 1

The Broken Rung: How AI is Rebuilding Software Development from the Ground Up

Tomislav Tipurić

Chief Technology Officer, Nephos

Tomislav Tipurić