Ruby Video
Talks
Speakers
Events
Topics
Leaderboard
Sign in
Talks
Speakers
Events
Topics
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
RubyConf 2018 - Hijacking Ruby Syntax in Ruby by Satoshi Tagomori & Tomohiro Hashidate This talk shows how to introduce new syntax-ish stuffs using meta programming techniques and some more Ruby features not known well by many Rubyists. Have fun with magical code! Show Ruby features to hack Ruby syntax (including Binding, TracePoint, Refinements, etc) Describe stuffs introduced by these techniques method modifiers (final, abstract, override) Table-like syntax for testing DSL Safe resource allocation/collection (with, defer)
Date
Summary
Markdown supported
This talk, presented by Tomohiro Hashidate and Satoshi Tagomori at RubyConf 2018, delves into the fascinating world of hijacking Ruby syntax through various metaprogramming techniques. The speakers emphasize Ruby's flexibility and power by demonstrating how developers can extend Ruby's capabilities by employing lesser-known features and methods. Key points discussed throughout the talk include: - **Introduction of Speakers**: Tomohiro Hashidate shares his background as a data engineer and introduces his co-speaker, Satoshi Tagomori, an open-source software developer with experience in IoT services. Their collaboration stems from their engagement with the Ruby community in Tokyo. - **Binding**: The concept of Binding is outlined as a context object encapsulating local and instance variables. The speakers present examples showing how binding allows access to these variables and how it can be manipulated through the 'binding-proxy' method. They emphasize the controlled management of variables in their respective contexts. - **TracePoint**: They explain how TracePoint can trace events within the Ruby Virtual Machine. By hooking into various events, they demonstrate how to gather information about method calls and class definitions, as well as to manipulate the behavior of methods based on their context. - **Refinements**: The presentation elaborates on refinements as a means to create local extensions of classes, emphasizing safety and method visibility. The speakers highlight how refinements can help in better code organization and refactoring. - **Method Hooks and Modifiers**: The possibility of tracking method definitions using hooks is introduced. The speakers draw parallels to Java by introducing method modifiers like 'final', 'override', and 'abstract', showing how these concepts can make transitioning from Java to Ruby easier for developers. They caution that improper use of hooks can lead to complex debugging scenarios. - **Safe Resource Allocation**: Discussing resource management in Ruby, they propose a syntax to allocate and deallocate resources efficiently, drawing parallels with familiar constructs from languages like Java. This allows for cleaner code while managing resources effectively. - **Conclusions and Takeaways**: The speakers wrap up by reinforcing the versatility that these metaprogramming techniques offer to Ruby developers. They encourage the audience to leverage these advanced features creatively in their projects. They invite questions, indicating their enthusiasm for sharing the wonders of Ruby programming. Overall, this talk aims to enrich Ruby developers' understanding of how to push the boundaries of Ruby's syntax and behavior using innovative techniques, thus enhancing their coding practices and toolsets.
Suggest modifications
Cancel