eigenclass logo
MAIN  Index  Search  Changes  PageRank  Login

evil.rb wants love

evil.rb is an experimental library that makes it possible to manipulate internal structures from the Ruby interpreter*1.

If you're interested in the internals of the interpreter, evil.rb can prove an excellent educational tool, since it allows you to peek into the object model, method dispatching...

In the past, some people have been using evil.rb to *2

  • change the class of an object
  • manipulate the inheritance chain for fun and profit
  • grab instance variables or singleton methods
  • swap objects (ever heard of Object#become?)
  • change the self context of a Proc (the way 1.9's instance_exec does)
  • mess with the flags of an object (frozen, tainted...)

Here's a list of articles where evil.rb is used to extend Ruby or illustrate how the interpreter works (please drop a comment if you have additional pointers of interest):

evil.rb wants some love from people willing to add new features and/or maintain it. If you want to play with it and don't mind hacking code that is meant not to be used in production, feel free to contact Florian Groß (flgr at ccan.de) or me.

Object#become - Daniel Berger (2007-04-12 (Thr) 12:57:46)

As per the discussion on oreillynet, it appears that Object#become was removed due to compatibility issues with 1.9. I'd like to see it added back for the 1.8.x users, with a big warning sticker for the 1.9 folks.

Last modified:2007/04/12 09:30:33
Keyword(s):[blog] [ruby] [frontpage] [evil.rb]

*1 using DL to access the C structs

*2 some features have been disabled in recent revisions