On Mon, 10 Mar 2008, Robert D. 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 C. Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : [email protected]
New Zealand