[MacRuby-devel] [MacRuby] #528: Improve Tail Call Elimination

MacRuby ruby-noreply at macosforge.org
Thu Dec 31 18:21:55 PST 2009


#528: Improve Tail Call Elimination
-------------------------------------+--------------------------------------
 Reporter:  haruki.zaemon@…          |       Owner:  lsansonetti@…                         
     Type:  enhancement              |      Status:  new                                   
 Priority:  minor                    |   Milestone:                                        
Component:  MacRuby                  |    Keywords:  tail call elimination optimisation tco
-------------------------------------+--------------------------------------

Comment(by conradwt@…):

 Replying to [comment:3 haruki.zaemon@…]:
 > > In regards to writing recursive methods, one would usually use
 memoization technique(s) in conjunction with recursion to eliminate
 wasteful calls.
 >
 > I'm not worried about wasteful calls. Recursively descending through a
 large data structure is the problem.
 >

 If you need tail call optimization, then you're definitely concerned about
 the wasteful calls because the goal of tail call optimization is to
 transform
 recursive alogithm into iterative algorithm.  Thus, reducing the overall
 stack space used and approve the efficiency of the running algorithm.
 Memoization
 is a manual way of achieving this that greatly decreases stack frame usage
 but I guess that you're looking for something  automatically done with
 MacRuby
 VM.

 > > Also, all core data structures or containers within Ruby Programming
 Language provide mechanisms for easily iterating through their contents.
 >
 > Perhaps the example was misleading, these are custom application data
 structures with thousands of nodes.

 Yes, there could be thousands of nodes within your custom application data
 structure but it's still your requirement to implement the appropriate
 traversal algorithm for the data set that you're operating on.  In short,
 one should use the best algorithm for the job and not rely so heavily on
 what's
 happening within the language's internals.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/528#comment:7>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list