In that email, I suggested using a named array rather than a simple array to pass the parameters. Do you think this might provide more clarity?
It's a good idea, but I don't think it'll improve clarity. I think the current format is easier to write and read than having named params.
I guess its partially a matter of opinion, but I still think that the second example, where you pull out the parameters you care about by name is the most clear.
As Rowan pointed out, this matters the most when you want to alter the parameters getting passed through. When you find yourself requiring a new parameter, all of a sudden the coherent ordering and groupings of parameters makes no sense, and with positional arrays, your only option would be to tack something new on the end. This inevitably makes the positional ordering haphazard and illogical over time.
Named parameters are really common in both Perl and Python:
http://www.unix.org.ua/orelly/perl/perlnut/ch10_04.htm http://docs.python.org/tut/node6.html#SECTION006720000000000000000 (actually built into the language as part of the syntax)
but for whatever reason, not so much in php.
I think there are many arguments out there for their advantages over positional arrays.
And wfRunHooks() itself would be slightly more complicated.
Really? I would think it would make wfRunHooks simpler. No more var arg processing. A fixed, identical signature for every hook function:
myHookFunction ($parameterArray)
and that array would be the only thing that wfRunHooks would ever need to pass through to the hook function.
Its just more work on the receiving end of each function to unpack the parameterArray.
Maybe I am missing something...
Also, what about including this actual setupTemplate processing hook that I proposed?
I'll try to get to it, but it's a separate issue. I'd also like to set output events at a really fine grain.
Well even introducing at least one hook lets someone add new variables to the context of the template. At the moment there is a ton of code you need to carry around if you just want to add even one new variable to a template. The "cleanest" way I have found to do this without hooks, is by overriding buildNavUrls in my subclassed skin, but I end up having to copy/paste a ton of code just to add a few more variables to the templates context.
Thanks, Jonah