From: Roger Pack Date: 2008-12-09T02:16:21+09:00 Subject: [ruby-core:20429] Re: Proposal: deferred blocks > Several people have played around with solutions that use ParseTree or > RubyParser to extract the contents of a lambda and perform certain > operations. > For instance, > Article.select {|a| a.title =~ /Some title/ } > would generate "select * from articles where title ~ 'Some title'" > This requires access to the ParseTree at runtime, which requires converting > a proc to a ParseTree at runtime. I've been toying with the idea of an > explicit language feature, like lisp quoting, that would explicitly pass the > ParseTree to the method called. Yeah for me Proc#to_s and Method#to_s would also be quite useful, if only as a tool allowing people to do cool things like that [stronger introspection]. It would make it possible to extract parameters and default values trivially, too, as well as docstrings, etc. As a side note, proc#parameters returning more default values [like strings] would be nice too [strings, etc.], Thanks! -=R