From: Siemen Baader Date: 2009-11-15T17:58:08+09:00 Subject: Traversing the contents of a proc (for a DSL) Hi List, Is it possible to traverse and modify the statements inside a Proc after it has been created? I'm playing with a small DSL for HTML, which should look like this. html { head { title {"Hello World"} } body { h1 { "hello"} p { "text body" "more text" } } } If it is possible to recursively traverse through the statements in each block, I could join the lines together with the + operator, and the implementation would be fairly easy - just recursive calls that return text. But it does not look like this is possible... An alternative would be to create a new object for each node in the HTML (eg body or h1), and let each method call inside this node assign its content to an array there. Less functional style and more overhead, but doable. But this requires either that I catch the creation of new strings (no idea if that is possible) for them to be added to the node as well, or that I introduce a new method to create strings. Any comments highly appreciated! cheers, Siemen