Skip to content

Instantly share code, notes, and snippets.

@lloyd
Created August 21, 2009 23:21
Show Gist options
  • Save lloyd/172501 to your computer and use it in GitHub Desktop.
Save lloyd/172501 to your computer and use it in GitHub Desktop.
Title
[Please provide a descriptive (but short) title for your session.]
Embedding Ruby for Fun and Profit
Description
[Provide a short summary description of your session topic. This will
be posted publicly if your proposal is accepted.]
Life is too short to write native code. It takes too long, it works
differently on different computers, you have to use a compiler, and
it's really difficult to do whilst inebriated. Whatever should we do?
One answer is to stop writing native code by embedding a high level
language. Ruby turns out to be ideal for embedding: the runtime is
very small, the standard library is quite complete, and the community
rocks. The downside? Embedding ruby can be extremely challenging
given the absence of up to date documentation and the minefield of an
API for the embedder.
This talk will be presented by Martin Robinson of the Titanium project
(by Accelerator) and Lloyd Hilaiel of the BrowserPlus project (by
Yahoo!). These two people working on open source projects which embed
ruby will share with you their experience in polishing ruby to a high
shine inside their projects, and give the tools you'd need to do the
same.
Abstract
There are only a handful of projects about the web that embed ruby,
some these include BrowserPlus, Titanium, SketchUp, mod_ruby,
(mrobison: any others that come to mind?). The act of embedding is very
much a black art, those who practice the art are few and far between.
This talk, while niche, would lay bare the state of the art of embedding
ruby, and would be presented by two of the leading "ruby inside" open
source projects.
In this talk the onion will be peeled from the outside in with two
interleaved perspectives on each topic, and we'll be careful to set
context along the way so that even folks without experience with ruby
internals will be able to take away an understanding of the process. The
talk is broken roughly into 5 sections
"The Finished Product" We'll set context by viewing high level
demonstrations of a BrowserPlus and Titanium in action. We'll briefly
the benefits and drawbacks of leveraging the ruby language.
This will be as terse as possible to deliver a concrete idea of the context
in which ruby is embedded without overly focusing on the specific projects.
"The Developer API" Both projects expose a ruby API to developers, and well
dig into the specifics of crafting this API. We'll cover some of the design
decisions that went into the ruby/developer contact points, as well as
explain and motivate differences from "standard" ruby. Finally we'll talk
about the way these APIs are presented and discovered by developers.
"How It works" We'll walk through a high level description of how ruby fits
into these two projects.
"Doing" Having set context, we'll walk through the key aspects of the
task of embedding ruby, and again, every question will be answered in
duplicate, giving two perspectives for observers to choose from:
* Ruby 1.8 or 1.9?
* Diet Ruby - Optimizing the distribution for size.
* How do I get the built libraries and headers?
* Does ruby run in a separate process?
* How do I support Multiple evaluation contexts?
* Ruby threads vs native threads? Threaded AND Embedded?
* Data conversion, how do I get data back and forth between
ruby and native code?
* Impressing your friends with unnatural C. (aka. the trippy
embedding API, that we really like).
"More, Faster, Better" Tickled and teased with ruby embedding, these
authors want more. We'll leave with a couple concrete suggestions to
make ruby an even better choice for embedding.
Presenters
Martin Robinson <[email protected]>
Lloyd Hilaiel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment