~/talk

Dissecting a Ruby Block

Talkat RubyConf 2012 · 2012-11-01..11-03· [ruby]
links:none on file
slides:none on file

Code-level claim: a Ruby block is a closure — a compiled instruction sequence plus its referencing environment — implemented in MRI C by an rb_block that stores an iseq pointer and a dfp (dynamic frame pointer) (and a cell/self pointer). Experiments using VM stacks, control-frame copies and examples like 10.times yielding, lambda returning a proc (which copies the stack frame to the heap) and binding creating an rb_binding show procs, lambdas and blocks are the same mechanism and they work as described.

AI-written summary · about

  1. 0:00Introduction
  2. 4:24Study Ruby internals and closures
  3. 6:50Ruby block under microscope
  4. 11:45Ruby VM and block structure
  5. 17:43Blocks reference parent scope
  6. 22:39Blocks as closures and history
  7. 23:00Origins of lambda in Ruby
  8. 25:48Lambda converts blocks to objects
  9. 30:59Closures and metaprogramming
  10. 38:00Bindings and eval as closures
  11. 40:46Summary of Ruby closures
~/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.