Wednesday, January 03, 2007

Representing Ruby Objects

Just a note, this post is a work in progress, and should see updates about twice a week. Hopefully it's useful even while it's incomplete.

Representing Ruby Objects

To start with, it's probably worth describing a bit about how rubinius source is laid out, then we can dive into the specifics about Ruby objects.

The rubinius source tree is laid out like this (omitting stuff we're not interested in for now):

(trunk)
 kernel/
   core/
 lib/
   bytecode/
   cpu/
 shotgun/
   lib/
The kernel and lib directories contain the Ruby code required to implement any given object. The few things that can't be written in Ruby are written in C, and live in shotgun/lib. Having as much code as possible written in Ruby makes approaching rubinius very easy.

Internal Representation of Ruby Objects

The files we're most concerned with are:

  • lib/object.rb
  • shotgun/lib/object.h
  • shotgun/lib/object.c

1 comment:

andre said...

Keep writing this stuff, it rocks :)