Tatsuhiro Ujihisa
Tatsuhiro Ujihisa


Play with local vars

This 40min talk is only about Ruby's local variables. I'm not going to talk about anything else.

I'll demonstrate, or more precisely, play with Ruby local variables, including a discussion about the following common pitfall:

eval 'a = 1'
eval 'p a' #=> NameError!

Ruby has multiple different types of variables: global vars, instance vars, class vars, constants, local vars, and pseudo vars such as self. Identifiers without sigils such as @ are considered either local vars, methods, method arguments, block parameters, pseudo variables, or other reserved words. Particularly important aspect I believe is that Ruby intentionally tries to make local vars and methods indistinguishable for human. This talk focuses only on local vars among other variables or methods.

  • Keywords: parse.y, binding, yarv iseq, continuation, flip-flop operator, regular expression, and gdb

Oh by the way, the whole presentation is likely going to be done inside my Vim.

Presentation Material

Recorded video