[Rake-devel] Why do MultiTask and Task send different args to their prerequisites?

Michael Bishop mbishop at me.com
Wed Nov 21 17:33:49 UTC 2012


I made a patch in my branch to make these the same. The test-suite runs to completion, but I'm still wary of it since I don't know if there are good reasons for them to be different :)

 https://github.com/michaeljbishop/rake/commit/ca283160b610c95e1f28cf561af8811fd37d10c3

_ michael


On Nov 21, 2012, at 12:08 PM, Jim Weirich <jim.weirich at gmail.com> wrote:

> 
> On Nov 21, 2012, at 2:36 PM, Michael Bishop <mbishop at me.com> wrote:
> 
>> Hello everyone,
>> 
>> I've been looking at something that has been confusing me for a while. It appears that MultiTask and Task send different arguments to their prerequisites and I can't figure out the reason why. I'm hoping someone on the list will know right away.
>> 
>> I've looked and the code for each case and expanded it and they are basically identical except for this last remaining functional difference between the two:
>> 
>> TASK
>> 
>> @prerequisites.collect { |p|
>>  prereq = lookup_prerequisite(p) # returns a task
>>  prereq_args = args.new_scope(prereq.arg_names)
>>  prereq.invoke_with_call_chain(prereq_args, invocation_chain)
>> }
>> 
>> MULTITASK
>> 
>> @prerequisites.collect do |p|
>>  prereq = lookup_prerequisite(p) # returns a task
>>  prereq.invoke_with_call_chain(args, invocation_chain)
>> end
>> 
>> 
>> Why the extra 
>> 
>>  prereq_args = args.new_scope(prereq.arg_names)
>> 
>> in the TASK case? How does its absence affect MultiTask argument processing? Shouldn't they be the same?
> 
> I have no memory of why task has it and multitask doesn't. I'll have to research this and refresh my memory on the whole task arguments implementation before being able to answer.
> 
> Stubbing out new_scope to just return the original arguments does cause a test to fail, so evidently its good for something.  I suspect that multitask just didn't get updated when the new_scope was introduced.
> 
> -- 
> -- Jim Weirich
> -- jim.weirich at gmail.com
> 
> 
> 
> 
> 
> _______________________________________________
> Rake-devel mailing list
> Rake-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rake-devel



More information about the Rake-devel mailing list