[Ruby2c] 2 new blog entries (and 2 questions at the end)
mark sparshatt
msparshatt at yahoo.co.uk
Mon Feb 7 01:48:10 PST 2005
Ryan Davis wrote:
> Covering a proof of concept building upon ParseTree that outputs a
> method's ruby code[1] and using that proof of concept to extend Refax to
> output suggested refactorings in pure ruby [2]. Example:
>
> Suggest refactoring HastilyWritten#weirdfunc from:
>
> def weirdfunc()
> puts("This is a weird loop")
> doSomethingWeird()
> begin
> puts("This is a weird loop")
> doSomethingWeird()
> end while keepgoing
> end
>
> to:
>
> def weirdfunc()
> begin
> puts("This is a weird loop")
> doSomethingWeird()
> end while keepgoing
> end
>
These don't seem to do the same thing, though. If keepgoing returns
false the first time it's called then the first version prints "this is
a weird loop" and calls doSomethingWeird twice, while the second one
only does it once.
That aside being able to query a method for it's source does seem to be
a very good thing(TM). It seems the next step would be to dynamically
modify that source.
> 1] http://blog.zenspider.com/archives/2005/02/rubytoruby.html
> 2] http://blog.zenspider.com/archives/2005/02/refax_the_autom.html
>
> META:
>
> 1) should I post this type of mail to ruby2c@?
> 2) should I post the actual entries to ruby-talk@?
>
I'd like to see posts like this on ruby2c. I can't say for certain about
ruby-talk
--
Mark Sparshatt
More information about the ruby2c
mailing list