Roger Pack wrote: > I think what we would be really sweet would be having a unified API > for being able to pull the parse tree out of methods and procs--then > people could rewrite them etc [currently possible in 1.8, not 1.9, as > noted previously ]. > > The reason I think it would be nice is that [as parse tree does > currently] the tuple output is something like > [:name, [:block, [:code_for_default_assignment]] which would be even > more useful. The problem with presenting parse trees are manifold: * The parse tree needs to be standardized or frozen * The parse tree needs to be retrievable at runtime (meaning you have to keep an AST or something similar even when you're not using it...huge memory waste) * Parse trees reflect internal details of implementation (like 1.8/1.9 parsing Iter as wrapping calls, and the reverse in JRuby). I'd strongly prefer a few targeted reflective APIs, like get_args, be added instead. > Note also that I believe Paul Brannan's ruby internals allows access > to introspecting blocks, etc. [2] and that there have been requests in > the past for more argument introspection [4] JRuby also provides a means of accessing all JRuby internals, which is how this args feature was implemented entirely in Ruby. I recommend similar features for other impls, but I imagine it's a bit harder to do across the board. - Charlie