~/talk

Around the Ruby Block

Talkat Rubyfuza 2018 · 2018-02-01..02-03· [ruby]
links:none on file
slides:none on file

Shows why a nested-RSpec let value unexpectedly becomes invisible inside an inner block: let creates a helper method, instance_eval-like calls change self, and that combination makes the inner block look on the wrong receiver rather than the outer local scope. Explains Ruby internals with C structs like RB_block_t and how the environment pointer ladder implements dynamic variable lookup. Demonstrates that lambdas allocate a heap copy so a lambda copies stack frame preserves locals, and benchmarks show block usage costing ~50% (up to ~71%) and find/lamda-made methods running about twice as slow.

AI-written summary · about

  1. 0:00Introduction to Ruby blocks
  2. 3:54Understanding block closures
  3. 11:57Dynamic variable access in blocks
  4. 13:22Self and scope in blocks
  5. 18:19DEF vs define_method
  6. 20:45Performance cost of blocks
  7. 22:35Lambdas and procs explained
  8. 27:58Memory impact of lambdas
  9. 30:52Binding objects and eval
  10. 32:17define_method and lambdas
  11. 35:05Conclusion and resources
~/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.