D
dblack
Hi --
I still don't have what I consider a complete fix on what we
collectively mean by metaprogramming, but I think I'd say that Ruby's
R&I facilities are preconditions of, or create a hospitable
environment for, metaprogrammming techniques.
For example:
unless obj.respond_to?(meth) # R&I
obj.singleton_class.class_eval {
define_method(meth) &block # metaprogramming, arguably
}
end
(using my favorite non-existent method, singleton_class
David
--
David A. Black
(e-mail address removed)
"Ruby for Rails", from Manning Publications, coming April 2006!
http://www.manning.com/books/black
How can I best rephrase, rewrite, etc the definition to show that
reflection is a key tool for doing manipulation, not something that
does manipulation itself?
I still don't have what I consider a complete fix on what we
collectively mean by metaprogramming, but I think I'd say that Ruby's
R&I facilities are preconditions of, or create a hospitable
environment for, metaprogrammming techniques.
For example:
unless obj.respond_to?(meth) # R&I
obj.singleton_class.class_eval {
define_method(meth) &block # metaprogramming, arguably
}
end
(using my favorite non-existent method, singleton_class
David
--
David A. Black
(e-mail address removed)
"Ruby for Rails", from Manning Publications, coming April 2006!
http://www.manning.com/books/black