Imported from previous forum
[ original email was from Mikael Brännström - m.brannstrom@ngm.se ]
Hi!
Could someone clarify which fields that will share dictionary entries in the following example?
-
Application type scope: Will Field1 and Field2 use the same dictionary entry?
-
Different dictionary types: Will Field1 and Field3 … ?
-
Application type scope again: Will Field1 and Field4 … ?
Regards
Mikael
- Yes, same key and same dictionary
- No, same key but different dictionaries
- Yes, in this particular use of Template2, same key, same dictionary and same application type. However, if Template2 was referenced from another template with a different application type, that use of Field4 would not share the same entry as the use of Filed4 through Template1.
Actually I think there is one constraint missing from the definition in section 6.3.1 to make it fully clear: It should have said that in addition to the specific constraints of any of the three listed dictionary types, two operators share the same entry only if they have the same dictionary name. I’ll make sure it is added to the errata.
A consequence of this (which was the initial intent) is that dictionaries are fully disjoint. That is, no operator will access entries in multiple dictionaries for the same combination of current template, current application type and key.
/David
Hi! Could someone clarify which fields that will share dictionary
entries in the following example?
Application type scope: Will Field1 and Field2 use the same
dictionary entry?Different dictionary types: Will Field1 and Field3 … ?
Application type scope again: Will Field1 and Field4 … ?
Regards Mikael
Will Template2 inherit application type from Template1? There is a statement in 6.4 section:
“A static reference specifies that processing should continue with the referred template as the current template.”
What does it mean? I was sure that application type should be changed too as a current template. It seem that I was wrong.
What dictionary will have Field2 from following example?
Will Field1 and Field2 share the same entry in the same dictionary?
- Yes, same key and same dictionary
- No, same key but different dictionaries
- Yes, in this particular use of Template2, same key, same dictionary
and same application type. However, if Template2 was referenced from
another template with a different application type, that use of
Field4 would not share the same entry as the use of Filed4 through
Template1.Actually I think there is one constraint missing from the definition in
section 6.3.1 to make it fully clear: It should have said that in
addition to the specific constraints of any of the three listed
dictionary types, two operators share the same entry only if they have
the same dictionary name. I’ll make sure it is added to the errata. A
consequence of this (which was the initial intent) is that dictionaries
are fully disjoint. That is, no operator will access entries in multiple
dictionaries for the same combination of current template, current
application type and key./David
Hi! Could someone clarify which fields that will share dictionary
entries in the following example?
Application type scope: Will Field1 and Field2 use the same
dictionary entry?Different dictionary types: Will Field1 and Field3 … ?
Application type scope again: Will Field1 and Field4 … ?
Regards Mikael
That particular sentence covers only the current template. The current application type remain unchanged with respect to a static template reference.
The current application type is covered in section 6.1:
“The current application type is initially the special type any. The current application type changes when the processor encounters an element containing a td:typeRef element.”
Field1 and Field2 will share the same entry in your example. But not Field3 since its dictionary is local to the type Type2.
/David
Will Template2 inherit application type from Template1? There is a
statement in 6.4 section:“A static reference specifies that processing should continue with the
referred template as the current template.”What does it mean? I was sure that application type should be changed
too as a current template. It seem that I was wrong.What dictionary will have Field2 from following example?
Will Field1 and Field2 share the same entry in the same dictionary?
What about dynamic references?
For example
<typeRef="Type1/>
Let suppose that Template2 was transmitted “inside” Template1. What dictionary will use Field1: “any” or “Type1”?
That particular sentence covers only the current template. The current
application type remain unchanged with respect to a static template
reference.The current application type is covered in section 6.1:
“The current application type is initially the special type any. The
current application type changes when the processor encounters an
element containing a td:typeRef element.”Field1 and Field2 will share the same entry in your example. But not
Field3 since its dictionary is local to the type Type2./David
Will Template2 inherit application type from Template1? There is a
statement in 6.4 section:“A static reference specifies that processing should continue with the
referred template as the current template.”What does it mean? I was sure that application type should be changed
too as a current template. It seem that I was wrong.What dictionary will have Field2 from following example?
Will Field1 and Field2 share the same entry in the same dictionary?
Type1 since it is part of the instruction context and since the current application type doesn’t change when following a template reference, only the current template is affected.
What about dynamic references?
For example <typeRef="Type1/>
Let suppose that Template2 was transmitted “inside” Template1. What
dictionary will use Field1: “any” or “Type1”?
[ original email was from John Cameron - john.cameron@orcsoftware.com ]
Similarly, I imagine that namespace is inherited from the referring template.
So that in the following modified example Field1 and Field4 would still share the same dictionary entry because the key’s are the same. This is because Field4 inherits the namespace of Template1, “Y”, despite the default namespace, “X”, declared in the surrounding templates element.
Is this correct?
Modified example specifying namespaces:
- Yes, in this particular use of Template2, same key, same dictionary
and same application type. However, if Template2 was referenced from
another template with a different application type, that use of
Field4 would not share the same entry as the use of Filed4 through
Template1.
No, namespaces have lexical scope, that is, a namespace is dependent only on a ns (or templateNs) attribute occuring on the element or any of its ancestors. So the Field1 and Field4 of your example will not share the same entry since the keys are in different namespaces.
This is the relevant paragraph of the spec, section 7:
“The namespace URI for application types, fields and operator keys is specified by the ns attribute which can appear either on the same element as the local name or on any ancestor element. If there are more than one ns attribute in the ancestry, the attribute of the nearest element applies. If no attribute is specified the namespace URI is the empty string.”
/David
Similarly, I imagine that namespace is inherited from the
referring template.
So that in the following modified example Field1 and Field4 would still
share the same dictionary entry because the key’s are the same. This is
because Field4 inherits the namespace of Template1, “Y”, despite the
default namespace, “X”, declared in the surrounding templates element.Is this correct?
Modified example specifying namespaces:
- Yes, in this particular use of Template2, same key, same dictionary
and same application type. However, if Template2 was referenced
from another template with a different application type, that use
of Field4 would not share the same entry as the use of Filed4
through Template1.
[ original email was from John Cameron - john.cameron@orcsoftware.com ]
Thankyou for the clarification.
I think that there is some ambiguity is in what exactly is considered as an “ancestor”. The intention is that it is purely lexical. However, a reader could mistakenly regard (as I did) an ancestor as being more dynamic - ie up through the templateRef referral. Particularly since type’s can be inherited in that way.
Perhaps that could be clarified in the spec.
John
No, namespaces have lexical scope, that is, a namespace is dependent
only on a ns (or templateNs) attribute occuring on the element or any of
its ancestors. So the Field1 and Field4 of your example will not share
the same entry since the keys are in different namespaces.This is the relevant paragraph of the spec, section 7:
“The namespace URI for application types, fields and operator keys is
specified by the ns attribute which can appear either on the same
element as the local name or on any ancestor element. If there are more
than one ns attribute in the ancestry, the attribute of the nearest
element applies. If no attribute is specified the namespace URI is the
empty string.”/David
Similarly, I imagine that namespace is inherited from the referring
template. So that in the following modified example Field1 and Field4
would still share the same dictionary entry because the key’s are the
same. This is because Field4 inherits the namespace of Template1, “Y”,
despite the default namespace, “X”, declared in the surrounding
templates element.Is this correct?
Modified example specifying namespaces:
- Yes, in this particular use of Template2, same key, same
dictionary and same application type. However, if Template2 was
referenced from another template with a different application
type, that use of Field4 would not share the same entry as the
use of Filed4 through Template1.