~/talk

Refinements - the Worst Feature You Ever Loved

Talkat RedDotRuby 2015 · 2015-06-04..06-05· [ruby]
slides:none on file

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

  1. 0:00Intro
  2. 2:39monkeypatching
  3. 5:05method wrappers
  4. 7:06defining a refinement
  5. 7:58using a refinement
  6. 11:18dynamic scope
  7. 14:18confusing code
  8. 15:08slows down the language
  9. 15:59security threat
  10. 16:43surprising corner cases
  11. 17:27refinements: the good
  12. 19:11lexical scope
  13. 21:57(almost) no confusion
  14. 22:21domain specific languages
  15. 23:26convenience methods
  16. 24:44refinements today: the good
~/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.