On 29.05.2012 17:02, Gregor Hagedorn wrote:
Hi Daniel,
They may not exist in the current form, but a
"local scope" will always exist.
Template parameter names are local the the current template "call". They have
to
be managed somewhere, so mediawiki will always have some way to manage data
attached to the "current call", and we can tie into that to put the
"default
item" into that "current" or "local" scope.
I am convinced if you can explain: the scope of this setting will
always be identical to template parameters. For example, it will not
be inherited if a template calls another template.
Hehe, good catch. I have been thinking about this, and I think that in the case
of default items, it would be consistent to let "sub"-templates (nested
template
calls) inherit the item set by a template further up. I'm not sure how this is
currently handled by the preprocessor. It's something to be investigated (maybe
we can have a chat with Tim about this in Thursday...)
Both the PHP preprocessor and Parsoid rely on template expansions being
purely functional for a single parser pass (see for example line 118ff
in Preprocessor_DOM.php). This means that a full expansion subtree can
be reused / cached if the parameters match.
It is possible to add scoped variables, but we'd have to carefully
consider the implications for caching, implementation complexity and
usability.
Gabriel