Mathieu Bouchard wrote:


>> > What do you mean exactly by "multiple files and locations" ?
>>If I generate 10 classes, I'd like to be able to specify if they all go 
>>into one file, if they each go into one single file, etc.
>>
> Well, that's something you can specify when you eval() the result.


I'm confused. I thought I specify that when I do .to_string, or to_pp, 
.write, or .serialize the constructed code; not when I eval it.


> That's because it does not work. I forgot to add eval in front of the
> string literal.


I don't want to eval the code, but write it to a file first.
Indentation matters for PP, so I'm using code which can be indented 
arbitrarily, depending on it's location, but always generates the same 
code with correct indentation.
I could generate the code, eval it, and then use it (instantiate objects 
etc.)
But because I'm generating the code from a large schema, which I don't 
want to read in each time I want to use the generated lib (takes a 
while), I stay with writing the lib to a file.


> I meant that XML is more tedious than the [[[]]] syntax. Often it's 2-3
> times more verbose. And in the case of the [[[]]] syntax there's at
> least one person dedicated to make it less so (me).
> 
> I don't know REXML. (I expect you to eventually tell me what features you
> need the most)


The internal representation doesn't matter to me. If I generate or 
manipulate XML with REXML, it's quite convenient, and that's how I'd 
like to generate code.

When I generate XML, I might never see actual XML until it's written out.
When I'd generated code with some lib, I'd never see the internal 
representation: when I serialize the stuff to a file, it's nice Ruby code.
So IMHO, the generation and manipulation API matters most when it comes 
to ease, convenience, and speed of use.

Tobi

-- 
http://www.pinkjuice.com/