[Rake-devel] recursive task invocation

Ittay Dror (Freiman) ittay.dror at gmail.com
Wed Aug 13 16:20:34 EDT 2008

On Wed, Aug 13, 2008 at 11:07 PM, Assaf Arkin <assaf at labnotes.org> wrote:
> If it's just an issue of Ruby recursion eating up the stack, why not
> change the algorithm so it's iterative using a proper stack to
> push/pop prerequisites?

right, and do it without recursion (i.e., don't start from the top
task, asking it to push its prerequisites and then ask them to push
their prerequisites).

> Creating a tree of prerequisites before invoking a single task would
> change the way you use Rake, I'm one of the people who's code would
> get affected.

the only thing that will be affected is if you have a task that
overrides the 'invoke_prerequisites' so that it takes into account the
results of 'execute' of those prerequisites (someone mentioned in this
thread a task that he wants to get executed if one of its
prerequisites succeeded). note there's a distinction between 'invoke'
and 'execute'.

other than such scenario, i don't think any code will be affected. all
tasks will be 'invoked'. their invocation will be to return their
prerequisites which can be very dynamic, overriden by tasks etc. then,
the resulting list will be iterated and executed. any dynamic
prerequisites code, other than one that examines the execution result,
will work as before

and as i mentioned there are other benefits besides avoiding stack
overflow, mainly, the ability to utilize several cores/cpus without
thrashing the machine and being able to stop the whole execution on


> Assaf
>> --
>> -- Jim Weirich
>> -- jim.weirich at gmail.com
>> _______________________________________________
>> Rake-devel mailing list
>> Rake-devel at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rake-devel
> _______________________________________________
> Rake-devel mailing list
> Rake-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rake-devel

More information about the Rake-devel mailing list