Sunday, January 04, 2009

Show Me Your Meta

I'm working on a presentation on Ruby metaprogramming, and I'd love to have more examples from the outside world. If there's any piece of metaprogramming you've seen in open-source code that you thought was particularly clever, readable, convoluted, or gratuitous, please comment or email with links to the source (or at least a pointer in the general direction).

If you have some non-public-source example you think is interesting, please feel free to email me along with information about how I can use the example (and whether you want "credit" for supplying it).

Thanks!

3 comments:

Sudhindra Rao said...

Hi John,
I know you must have seen this code already, but incase u missed it

http://blog.brianguthrie.com/articles/2008/08/02/the-weirdest-code-ive-seen-recently

-Sudhindra

drew olson said...

Interesting stuff here. What about talking a bit about instance_eval and the tradeoffs for using it within DSLs. I really enjoyed this article for a deep dive about the tradeoffs (not endorsing the gem, though): http://www.daniel-azuma.com/blog/view/z3bqa0t01uugg1/implementing_dsl_blocks

Anonymous said...

If you are talking about define_method, it might be worth talking about its strange behavior with respect to arity in ruby 1.8: http://www.pgrs.net/2008/12/31/strange-behavior-with-define_method-and-the-wrong-number-of-arguments