Interface Dispatch: Itabs, Indirection, Escape, and Typed Nil
Separate interface data storage, dispatch, devirtualization, and typed-nil semantics.
This chapter is part of the paid launch. The preview stays visible so readers can evaluate the exact scope before buying.
Core and Complete. Complete also includes the practical exam and free Go-version updates.
What this chapter teaches
An interface is just a function pointer. Calling through one costs a single indirect call — cheap.
an interface value is two words — a pointer to its method table (the itab) and a pointer to its data. Three costs follow. Creating one usually heap-allocates, because the data word must point at the value (the boxing in the cold open). Calling through one is an indirect call that the compiler cannot inline, which blocks the downstream optimizations inlining unlocks (Chapter 4). And the itab lookup people worry about is actually the cheap part — cached and amortized to a pointer comparison. Plus a correctness trap: an interface is nil only when both words are nil, so a nil pointer stored in an interface is not == nil.
Unlock Chapter 09 and the rest of the course.
Core unlocks every paid chapter and lab. Complete also includes the practical exam and future Go-version updates.
Full course access with the complete mechanics curriculum.
Best-value launch option with the exam and free Go-version course updates.
No subscription or account required. Access is tied to the email entered at Stripe Checkout and can be restored by email.