On Wednesday 29 August 2007, Raymond Bosman wrote:
> > > Personally, I compare each template with a function. The {use}
> > > variables are the function arguments. I think all the solutions we
> > > proposed are used in one or another way in a programming language.
> >
> > Yes, this is what I do as well. Can you give me examples of the original
> > three proposals in programming languages? The last two have parallels to
> > programming languages except you don't know in which context your
> > template will be called and so don't know which globals will be
> > available....
>
> Solution 1, 2, and 3 can be seen as a nested function definition.
>
> def template_p(a,b,c,d,e,f):
>
>     def template_q(a):
>         print a
>
>         def template_r():
>             print b
>             print c
>
>
> Function template_p is called from the user application; thus has all
> variables. template_p does an {include "template_q" send a}. That template
> includes template_r. All those sub-includes have access to the variables
> from the top function scope.
This is not the same since the sub methods are created within the context of 
each other., and the variables passed implicitly are set from this context. 
Also, the methods are only available in the context in which they were 
created. This is not the case with the template definitions, they are just 
loose "function" definitions which can be called from anywhere.

Freddy San

-- 
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components

Reply via email to