YoVDO

Understanding Nil

Offered By: Gopher Academy via YouTube

Tags

GopherCon Courses Go Courses

Course Description

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore the intricacies of 'nil' in Go programming through this GopherCon 2016 talk by Francesc Campoy. Delve into the concept of nil as a zero value, its historical context, and its significance across various data types. Discover when nil is not actually nil, learn best practices for error handling, and understand the practical applications of nil in receivers, slices, and maps. Gain insights into leveraging nil channels in select statements, using nil interfaces for default signaling, and recognizing the overall utility of nil in Go programming. Through code examples and explanations, master the nuances of nil to write more efficient and idiomatic Go code.

Syllabus

Intro
welcome every single one of you
nil is (a) zero
interlude a bit of history
zero values what are they?
the type of nil
nil is a predeclared identifier representing the zero value for a pointer, channel, func, interface, map, or slice type.
zero values what do they mean?
type, value
when is nil not nil?
do not declare concrete error vars
do not return concrete error types
nil receivers are useful
use nil slices they're often fast enough
use nil maps as read-only empty maps
coding time
can we switch off a chan?
use nil chans to disable a select case
'nil values can satisfy interfaces
use nil interfaces to signal default
nil is useful


Taught by

Gopher Academy

Related Courses

Разработка веб-сервисов на Go - основы языка
Moscow Institute of Physics and Technology via Coursera
Getting Started with Go
University of California, Irvine via Coursera
Concurrency in Go
University of California, Irvine via Coursera
Functions, Methods, and Interfaces in Go
University of California, Irvine via Coursera
Game Thinking: Juego y toma de decisiones
The Pontificia Universidad Javeriana via edX