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

Jim Weirich jim.weirich at gmail.com
Wed Nov 21 17:08:28 UTC 2012


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







More information about the Rake-devel mailing list