A developer\’s blog

Metaprogramming Talk 62

Posted by mikongon May 22, 2008

I’d like to thank everyone who attended the Philippine Ruby Users Group (PHRUG) May ‘08 Meetup and listened to my over-2-hour talk on Metaprogramming. Thanks for the patience, for not sleeping (or not making it obvious), and for those wonderful questions. It’s tough discussing the object model of Ruby when terms are repeated like ‘the superclass of the metaclass of the Ninja class is the metaclass of the Object class’. I literally had a headache after the talk.

Coding Session

I had a problem with Ruby2Ruby.translate at one point in the coding session. I’ve just confirmed what was pointed out to me. Indeed, Ruby2Ruby couldn’t translate a class without a method definition. What you all wanted to see was what would this:

module Taijutsu
def punch
puts 'punch'
end
end
class Ninja
include Taijutsu
end

look like when Ninja is translated using Ruby2Ruby. Here it is:

class Ninja < Object
def punch
puts 'punch'
end
end

Unfortunately, Ruby2Ruby won’t show an include call, as a lot of you had hoped.

Slides

Minor note: I used back quotes in my slides to refer to singleton classes and metaclasses. I thought this was the standard but looks like it’s not. Patrick Farley used the normal single quotes before the names in his slides. The pickaxe book used single quotes after the class name (for metaclass) and ‘anon’ which means anonymous class (to refer to the singleton classes and include classes of modules).

A celebrity? PHRUG monthly meetups aren’t big. I had about 10 people listening to my talk. And I volunteered for this. It’s not like they were requesting for some guru to speak. But I learned a lot, and I hope the audience learned as well. Also, the coding session was fun!

[…] changing the tires while the car is running metaprogramming, not mere introspection. …michael galero Blog Archive Metaprogramming TalkAs I mentioned, my talk was largely based off of Dave Thomas’ Metaprogramming talk in QCon London 06 […]