Classboxes, nested methods, and real private methods
summary
Proposes a concrete feature: lexical refinements activated lexically that live in modules and are enabled with module using to scope method overrides to specific files or classes only, keeping global behavior unchanged while allowing nested methods and truly private helpers. Implementation lives in a private repo, supports inheritance rules, allows calling original via refinement super, cannot refine modules directly (cannot refine modules), shows benchmarks (~2.5% slower) and rejects dynamic classboxes.
AI-written summary · about
chapters (40)
- 0:00Start
- 0:48Self introduction
- 3:04Topics
- 3:35What are Classboxes?
- 3:49How to extend classes in Ruby?
- 4:13Aspects of subclassing
- 5:38An example of LSP
- 6:31A typical LSP violation
- 8:25A Ruby-specific LSP violation
- 8:50Subclassing != Subtyping
- 9:46Aspects of mix-in
- 10:43Aspects of singleton methods
- 11:21o⚫⚫ Aspects of open classes
- 11:41Ruby on Rails
- 13:30LSP and open classes
- 13:57an LSP violation
- 15:27What we need
- 15:44Possible solutions
- 15:54selector namespace
- 18:09An example of Classbox/J
- 18:54An example of local rebinding
- 19:59Is local rebinding needed?
- 21:50An example of Refinements
- 22:50Demo
- 26:22Class local refinements
- 27:22An example of Module#using
- 28:00using and include
- 29:03Using original features
- 29:58An example of special eval
- 30:15Compatibility
- 30:52Applications of refinements
- 31:09Refinements of built-in classes
- 33:18Nested methods
- 34:17Additional benchmarks
- 34:42Benchmark result
- 35:39Considerations
- 36:44Workaround
- 36:55Should modules be refinable?
- 37:15Implementation improvement
- 37:33Conclusion








