Faraaz Ahmad

Talk: Ruby without the syntax

Software Engineer. Building InvoiceMod on the side.

Ruby without the syntax

Have you ever wondered how Ruby works under the hood? Why MRI is called CRuby? or how people write fast native extensions for Ruby?In this talk we will take a deep dive into Ruby’s C internals and make a simple Ruby program without any of the Ruby syntax!

This talk briefly touches upon what happens to a Ruby VM internally when a program is written. It then introduces the Ruby C API, which is used by gem authors to write native extensions, and the core team to work on Ruby. Finally, we write a simple program that runs within the Ruby VM but is written entirely in C, using the Ruby C API.

Here is the outline of the talk:

Intro: Ruby as a dynamic language

  • It is compiled and also interpreted.
  • How the Ruby VM (YARV) works under the hood
  • The lifecycle of a CRuby program.

More than just syntax:

  • Gems with native extensions
  • What is the Foreign Function Interface (FFI)

Ruby C API: Learning by building a simple program for calculating area of shapes

  • Initialising the VM
  • Calling eval from C and handling errors
  • Objects and methods
  • Classes and modules

Mess-around driven development: Conclusions and takeaways

  • Building things just for fun.
  • Learning by messing around.


I’m a software engineer with 4 years of professional experience, currently working in Bengaluru, India. I have always been interested in different kinds of programming languages and their internals, so I once made a small language for myself.

I am also a big fan of football/soccer and the tactics used by coaches in these games, if allowed I would spend the whole day just talking about this. I also play a video game called Football Manager where I pretend to be the head coach of a professional football team.

I also enjoy running, sketching, rock climbing and making Web UIs look better than they are!