~/talk

Functional options for friendly APIs

Talkat dotGo 2014 · on Friday, 2014-10-10· [go]
slides:none on file

Argues that using functional options — variadic configuration functions applied to a freshly created struct pointer — keeps defaults concise, avoids nil or empty sentinel values, and prevents callers retaining internal config. Shows concrete tools: option functions that mutate a server value, a TLS option that wraps the listener in TLS, and a speed returns closure pattern for parameterized options. Demonstrates the pattern on a real Go terminal/serial package where options are applied in order, errors abort and trigger cleanup, and the API becomes simpler and extensible.

AI-written summary · about

  1. 0:00Start
  2. 1:01Features, features, features
  3. 3:26Many functions make light work
  4. 4:44Limited options
  5. 6:03Maybe adding indirection will help
  6. 10:30Functional options, cont
  7. 12:16Term (improved)
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.