~/talk

Nil - Nothing is Easy, Is It?

Talkat Blue Ridge Ruby 2024 · 2024-05-30..05-31· [ruby]
slides:none on file

Nil causes expensive runtime errors and the talk gives concrete fixes: use the safe navigation operator (&.) (Ruby 2.3), prefer Array.wrap and .compact for collections, use .dig for nested hashes, avoid blanket rescue clauses, and consider result/option types (resad, dry-monads) or the Null Object pattern to replace nil at the source. ActiveSupport’s blank/present and conditional assignment are discussed, plus warnings about false vs nil and surprising language behaviors (compact on Enumerable added in Ruby 3.1).

AI-written summary · about

  1. 0:00Introduction
  2. 1:04Why this talk matters
  3. 2:10The billion-dollar mistake
  4. 3:57Nil in Ruby
  5. 5:41Nil behavior in Ruby
  6. 7:10Safe nil checks
  7. 10:41Nil assignment
  8. 12:28NoMethodError with nil
  9. 14:34Why nil causes problems
  10. 17:23Handling nil safely
  11. 20:34Safe navigation operator
  12. 22:42Replace nil with values
  13. 24:50Array.wrap to avoid nil
  14. 25:51Nested structures with dig
  15. 26:54Result types for failures
  16. 29:51Null object pattern
  17. 33:02Special case pattern
  18. 36:39Eliminating conditionals
  19. 38:25Other billion-dollar mistakes
  20. 40:12Further reading
  21. 40:53Q&A
~/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.