From: John Carter Date: 2008-03-11T13:31:11+09:00 Subject: Re: Best practices for Ruby Meta-programming On Mon, 10 Mar 2008, Robert Dober wrote: > attr_reader e.g. is nothing less than MP. I'd still be happier if I could flick a switch and see the intermediate vanilla code that was generated. > FWIAC metaprogramming is here to do things at runtime and nothing else > in the world can replace it. I suspect we've overloaded the term "meta-programming". There are "programs that write programs". There is a common subset of that ... "programs that instantiate generic template code by substituting template variables with concrete text." If by meta-programming you mean one of the meanings above this line, seeing a concrete vanilla ruby intermediate representation is invaluable. ---------------------------------------------------------------------- If by meta-programming you mean one of the following, creating concrete intermediate representations is harder..., but certainly not impossible. There are "programs that query & display the current run time state of the program". (Profiling, debugging, coverage, memory profiling & leak detection, object creation hotspot detection...) There are _very_ hairy programs "that query the current run time state of the program and modify the code 'on-the-fly' accordingly." > You know sometimes it is just the right tool to use, *sometimes*. Their are times and places where on-the-fly self-modifying code is appropriate. They are clearly marked on the map as "Here be Dragons". John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand