Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
The fact that Ruby has different implementations is both strange and powerful. Writing an extension for the language can be a daunting task but there's no better way to get to the heart of what exactly Ruby objects are and the reason for some of the language's quirks. In this talk, we'll use an example of writing a C extension for Ruby to use a third-party C security library. We'll peel back the layers of Ruby objects to deepen our knowledge of MRI and to understand in a little more detail what it really means to write object-oriented code. Help us caption & translate this video! http://amara.org/v/Fqst/
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 her talk "Ruby-red onions: Peeling Back Ruby's Layers in C Extensions" at RubyConf 2014, Emily Stolfo explores the intricacies of writing C extensions for Ruby. She aims to demystify the process and enhance understanding of Ruby's underlying architecture, specifically the C Ruby interpreter (MRI). Key Points: - **Introduction and Background**: Emily introduces herself as a developer for MongoDB's Ruby driver and an adjunct professor teaching Ruby on Rails. She discusses her personal journey of writing a C extension, particularly for Kerberos authentication. - **The Challenge of C Extensions**: Emily emphasizes that while writing C extensions can seem daunting, it is a valuable skill. Many developers, including herself, initially shy away from this task. - **Learning Experience**: Emily recounts her challenge with implementing GSSAPI Kerberos support for MongoDB, highlighting that the task was postponed due to its complexity and low priority in the Ruby community. Despite alternatives like the gssapi gem, the intricacies and issues led her to opt for a direct C extension. - **Understanding Ruby and C Interfacing**: She discusses the unique structure of Ruby as a high-level language operating over a foundation of C code. Emily compares Ruby to an onion, with multiple layers of abstraction that developers need to peel back to understand the interaction between Ruby and C. - **Key Resources for Writing C Extensions**: She points out several resources for learning, including examining existing extensions like Nokogiri, the Ruby source code, and blogs. The best documentation resides in the ext directory of the Ruby source code. - **Mechanics of Ruby and C Integration**: Emily explains the need for specific macros and methods for converting between Ruby objects and C data types. She details how to define classes in C, manage data, and enable transitions from Ruby objects to C structures and vice versa. - **Packaging and Distributing C Extensions**: Steps to package a C extension within a Ruby gem include creating an extconf.rb file, maintaining a gemspec, and using the appropriate C code organization. Emily shares her experience about issues encountered after releasing her initial gem version due to missing dependencies. - **Conclusions**: By the end of her talk, Emily aims to leave the audience feeling empowered to tackle their own C extensions by illustrating that the process enriches one’s understanding of both Ruby and C, revealing deeper insights into Ruby’s architecture. In summary, Emily's presentation is a detailed guide on writing C extensions for Ruby, providing essential knowledge, valuable insights, and encouraging developers to engage with this powerful capability.
Suggest modifications
Cancel