> I'd like to propose a way to introspect into the arguments of a method
> object.

Some of this functionality is available currently via
RubyVM::InstructionSequence.disasm [1]
[I'm not sure if it includes which methods have named blocks or what
their name's are].
Also note that ruby_parser was recently updated to be 1.9 friendly.
You could use Method#source_location to lookup methods' source, parse
it and use that for introspection [albeit unreliably, and not for
dynamically generated methods, but it's an option].


[3] is a patch that creates InstructionSequence.disasm_proc [or could
override InstructionSequence.disasm to accept procs and methods],
which would...be about half-way there.  A more unified ruby-wide
approach would be sweet, though.


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.

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]

Thanks for reading :)
-=R

[1] http://blog.zenspider.com/2008/06/dear-lazyweb-proc-disassembly.html
[2] http://blog.zenspider.com/2008/06/dear-lazyweb-proc-disassembly.html
[3] http://redmine.ruby-lang.org/issues/show/578
[4] http://redmine.ruby-lang.org/issues/show/440