Ruby keyword args and the options hash, from the parser to the virtual machine
summary
Argument handling turns out to be about implementation not syntax: Ruby treats keywords as an options hash under the hood, historical parser quirks cause empty-literal behavior, and early Ruby 2.1 keyword calls are much slower until VM work in 2.2 adds a KWARGS instruction that pushes keywords as regular parameters. The double splat semantics change from odd precedence to left-to-right merges, required keywords and performance fixes land but edge cases remain (implicit to_hash conversion, empty-hash dispatch).
AI-written summary · about
chapters (20)
- 0:00Intro
- 1:06Keyword vs positional args
- 3:10Connascence
- 8:48options hash as keyword args
- 10:33Splat & options hash
- 11:54Ruby 1.9 hash syntax
- 12:23Ruby 2.0 optional keyword arguments
- 13:12Ruby 2.1 required kwarg
- 13:26Original Gotcha
- 16:20Method call
- 16:59Array literal syntax
- 17:38Splat & double-splat
- 17:48Ruby 2.1 double-splat
- 20:42Double-splat **-implicit conversion
- 21:30Hash implicit conversion
- 22:27Performance
- 23:17Ruby VM
- 25:29Ruby 2.2 VM
- 26:30Ruby 2.2 hash syntax
- 27:12Repetition








