Refinements - the Worst Feature You Ever Loved
summary
Refinements ship in Ruby 2 as a way to localize monkey patches but the talk shows two concrete designs and their tradeoffs: dynamically scoped refinements let reopened classes and class_eval see changes but cause surprising, hard‑to‑reason behavior, potential security traps and interpreter slowdowns; lexically scoped refinements avoid performance and security problems and make super calls inside a refinement hit the original method but break DSL and convenience‑method patterns unless every file adds a explicit using and JRuby lacks Refinements so ecosystem fragmentation is a real risk.
AI-written summary · about
chapters (16)
- 0:00Intro
- 2:39monkeypatching
- 5:05method wrappers
- 7:06defining a refinement
- 7:58using a refinement
- 11:18dynamic scope
- 14:18confusing code
- 15:08slows down the language
- 15:59security threat
- 16:43surprising corner cases
- 17:27refinements: the good
- 19:11lexical scope
- 21:57(almost) no confusion
- 22:21domain specific languages
- 23:26convenience methods
- 24:44refinements today: the good
related talks
32mRefinements - the Worst Feature You Ever Loved
38mRefinements - The Worst Feature You Ever Loved
42mWhy is nobody using Refinements?
47mClassboxes, nested methods, and real private methods
53mRuby 2 in Ruby on Rails
34mHijacking Ruby Syntax in Ruby
45mToward a Design for Ruby
29mLet’s refactor some Ruby code
