Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Other programming languages have powerful features that are often enviable while working in Ruby: Python's function decorators, Scala's partial evaluation, and Haskell's lazy evaluation, among others. Fortunately, Ruby's metaprogramming facilities give us the ability to add these features to Ruby ourselves, without the need for the core language to be changed. This talk will walk through adding simple (yet functional) versions of the previously mentioned features to Ruby, using Ruby, and discuss the dos and don'ts of responsible Ruby metaprogramming. Help us caption & translate this video! http://amara.org/v/FGib/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the talk "Extending Ruby with Ruby" by Michael Fairley at Rails Conf 2012, the speaker discusses how Ruby's metaprogramming capabilities allow developers to incorporate features from other programming languages such as Python, Scala, and Haskell into Ruby. The talk emphasizes that while Ruby has its own strengths, it can also be extended to borrow useful features from these languages, thereby enhancing its functionality without needing core language changes. Key Points Discussed: - **Introduction to Metaprogramming**: Fairley explains that metaprogramming often involves techniques like `respond_to?`, `send`, and monkey patching to enhance Ruby's capabilities. - **Function Decorators Inspired by Python**: The talk showcases Python's function decorators as a mechanism to clean up repetitive code and simplify transaction management in Ruby. - An example demonstrates how decorators can manage database transactions elegantly, reducing boilerplate code and enhancing readability. - **Memoization in Fibonacci Example**: The speaker illustrates how memoization can improve efficiency in Ruby and proposes a decorator-style implementation reminiscent of Python's. - **Partial Application from Scala**: Fairley discusses partial application in Scala, highlighting its clarity compared to Ruby's syntax. He presents an example where Ruby can mimic Scala's style through a custom method, although he criticizes its ugliness and inelegance. - **Lazy Evaluation from Haskell**: Lastly, lazy evaluation is explained through a Haskell example, demonstrating how results are computed only when needed. Fairley proposes a Ruby implementation for lazy evaluation, showcasing its potential to optimize performance in certain use cases, albeit at the cost of complexity. - **Cautions Against Extending Ruby**: Throughout the presentation, Fairley notes the importance of caution when adding features, as it can lead to performance implications. He concludes that while it is feasible to import features from other languages into Ruby, it must be done judiciously to retain clarity and performance in Ruby applications. In conclusion, this talk encourages Ruby developers to leverage the language's flexibility to integrate powerful features akin to those found in Python, Scala, and Haskell, while being mindful of the potential pitfalls of such extensions.
Suggest modifications
Cancel