RubyKaigi 2025 Proposal
code:markdown
# RubyKaigi 2025 proposal
### Title (limited to 60 characters)
On the Fly Rewriting Method Deprecations
### Abstract (limited to 1000 characters)
Ruby's ecosystem has various ways to handle method deprecations, but the process of updating deprecated code often remains manual and time-consuming. This talk introduces a tool that automatically rewrites deprecated method calls at runtime by combining Ruby's metaprogramming capabilities with source code analysis.
I'll explore how library authors can define transformation rules for deprecated methods and how client developers can automatically update their code. The talk will demonstrate practical examples using Prism and Synvert, showing how these tools enable precise source code manipulation. This approach not only reduces the maintenance burden but also ensures smoother library upgrades.
Through this presentation, we'll see how Ruby's flexibility can be leveraged to create tools that make deprecation handling more automated and developer-friendly.
### Details
This talk is based on the author's experience of implementing a Ruby Deprewriter gem inspired by Pharo's Deprewriter. I will explain the implementation method of the Ruby Deprewriter and the techniques used in the implementation.
#### Intended audience
- Library maintainers who want to provide better deprecation experiences
- Ruby developers interested in metaprogramming and code transformation
- Teams dealing with large-scale codebase maintenance
#### Outline: What this talk covers
1. Deprecation issues in Ruby (5min)
- Current approaches (documentations, Gem::Deprecate, ActiveSupport::Deprecation etc.)
- Pain points in manual code updates
2. Learning from other languages (Pharo's Deprewriter) (5min)
- How Deprewriter identifies deprecated method call sites
- Defining transformation rules for deprecated methods
- Runtime code rewriting
- Why runtime transformation makes sense
3. On the fly rewriting method deprecations in Ruby (15min)
- How Deprewriter identifies deprecated method call sites
- Defining transformation rules for deprecated methods
- Runtime code rewriting with Prism and Synvert
- Configuration options for different automation levels
4. Future possibilities (5min)
- Integration with existing deprecation mechanisms
- Potential for ecosystem-wide adoption
- Challenges and limitations
#### Is it feasible?
Yes, there is a working implementation of Deprewriter in Ruby that combines:
- Ruby's metaprogramming for method interception
- Prism for precise source code parsing
- Synvert (to be precise, NodeQuery, NodeMutation) for code transformation
### Pitch
I propose to present a new approach to handling method deprecations in Ruby, based on my work on the Deprewriter gem. This talk combines practical utility with technical depth, showing how Ruby's powerful features and existing tools like Synvert can be used to solve real-world maintenance challenges.
#### Why deprecation handling?
While deprecations are a crucial part of library maintenance, the current approaches put most of the burden on client developers. Deprewriter demonstrates how we can make this process more automated and less painful, potentially influencing how the Ruby community handles deprecations in the future.
#### Why RubyKaigi?
RubyKaigi is the good venue for this talk as it brings together library authors and client developers who face deprecation challenges. The technical depth of the implementation, involving Ruby's metaprogramming capabilities and the new Prism parser, aligns well with RubyKaigi's tradition of exploring Ruby's advanced features.
Moreover, this work builds upon Ruby's recent developments (like Prism) and could contribute to discussions about improving Ruby's tooling ecosystem. The feedback from RubyKaigi's knowledgeable audience would be invaluable for the future development of this approach.
### Bio (~500)
Rubyist working on a banking system and a card payment system at SmartBank, Inc.