On Wed, 2007-08-29 at 15:40 +0200, Frederik Holljen wrote:
> On Wednesday 29 August 2007, Raymond Bosman wrote:
> > On Wednesday 29 August 2007 17:08, Frederik Holljen wrote:
> > > 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.
> >
> > Okay, it is not *exactly* the same. But think about the concept. The next
> > example comes closer?
> >
> > def user_application_send(a,b,c,d,e,f):
> > def template_q(a):
> > print a
> > template_r() # {include "r"}
> >
> > def template_r():
> > print b
> > print c
> It's a bit closer since you can call a sub-method slightly out of context.
> Can
> you actually do that in python? I'm not impressed... :D
>
> It makes me think about another option though, and that is to actually add
> contexts to our templates. If you say which context the template belongs to
> then you can start doing stuff like the above. A context can be as advanced
> as you like it to be.. it can be a string.. to a full blown "template class"
> declaration with templates (functions..).If you can't just live with passing structs and / or with (well documented) template function which gives you access to the data, I think this is a very nice concept. Template contexts could be imported and give you access to a defined (documented) set of variables... Nice idea! -- Mit freundlichen Grüßen / Med vennlig hilsen Kore Nordmann (GPG: 0xDDC70BBB) eZ Components Developer eZ systems Headquaters tel +49 (0) 231-9742-7750 | fax +49 (0) 231-9742-7751 [EMAIL PROTECTED] | eZ systems | ez.no
signature.asc
Description: This is a digitally signed message part
-- Components mailing list [email protected] http://lists.ez.no/mailman/listinfo/components
