On 05/26/2014 06:40 PM, Fabrice Bacchella wrote:
> Is that normal that params1 is part of the context in both case, but not param2 ?
Ugh. Scope semantics. It *does* seem a little weird. Here's my take:
1. $param1 is a local variable (a parameter) of myclass
2. Mytpe[mytype] is scoped into myclass
3. Mysubtype[/tmp/parsed1] is inheriting this scope from its enclosing
defined type
I will have to assume that defined types don't incur another level of
scoping of their own.
Then it kind of makes sense.
> I think the value of 'title' and name disturbing too. It should be either mysubtype and mytype or /tmp/parsed1 and /tmp/parsed2. But no a strange mix of both.
Uhm, no.
Your template is evaluated from inside these defined type instances:
Mytpe[mytype]
Mysubtype[/tmp/parsed1]
Therefor $name and $title *must* take the values 'mytype' and
'/tmp/parsed1' respectively. Anything else would be quite inconsistent.
HTH,
Felix