All I'd Wanted To Know About Ruby's Object Model Starting Out...And Mooar!!!
summary
Step-by-step reverse engineering of CRuby shows that all Ruby values are pointers to three C structs—RBasic RObject RClass—with a flags field, a class pointer, a superclass pointer and a method table pointer; bootstrapping runs init_vm_object then init_class_hierarchy; defining a class calls rb_define_class_id which sets super, initializes the RClass and calls make_metaclass to create singleton/metaclasses; modules become inserted as include classes that share the module’s method table; comparison to Python highlights a single metaclass type and the descriptor protocol.
AI-written summary · about
chapters (11)
- 0:00Start
- 1:56What Does It Like To Be a Beginner Learning Ruby
- 14:06Singleton Class
- 14:44Meta Class Creation
- 18:01Set the Superclass of the Metaclass
- 18:43Make a Singleton Class
- 19:37Modules
- 21:15Including Multiple Modules
- 23:34Differences between the C Class and Super Pointers and the Ruby Class and Super Class Methods
- 31:10Questions
- 31:51The Ruby Hacking Guide
related talks
29mAll I'd Wanted to Know about Ruby's Object Model Starting Out...and Mooar!!!
29mAll I'd Wanted to Know about Ruby's Object Model Starting Out...and Mooar!!!
36mMetaprogramming? Not good enough!
33mVenturing into the Spooky Science of Ruby
39mWhat lies beneath the beautiful code?
49mThe Well-Grounded Nuby
28mDeep Ruby
29mMRI Magic Tricks
