On 12/31/2011 5:16 PM, Geoff Adams wrote:
Hello,

I'm trying to understand the process of tag resolution in YAML 1.2, and some of the language in the spec seems unclear to me.  In particular, I am trying to understand the implications of this sentence from section 3.3.2:

"Resolving the tag of a node must only depend on the following three parameters: (1) the non-specific tag of the node, (2) the path leading from the root to the node, and (3) the content (and hence the kind) of the node."

To understand rule (2), I need to know the definition of a path to a node, which does not seem to be given anywhere in the spec.  From the rest of the section, it seems that the key node associated with a value node in a mapping is part of the value node's path.  My guess is that a path is then a list of nodes, constructed as follows:

For the root node:
  - Nothing, or a root path
For a value node in a mapping:
  - The path to the corresponding key node
  - The key node
For a key node in a mapping:
  - The path to the mapping node
  - The mapping node
For a node in a sequence:
  - The path to the sequence node
  - The sequence node

Is this correct?

I am also unclear about the interpretation of the rule, "resolution must not consider the content of any other node, except for the content of the key nodes directly along the path leading from the root to the resolved node." Is the tag of a node considered part of its content? Section 3.2.1.1 suggests that it is not. However, if the tag of a collection may be considered as part of the resolution process of its contents (rule 2), then attempting to resolve the tag of such a collection by rule (3) could potentially lead to circularity: the tag of the collection depends on the tags of nodes in its contents, but those tags may depend on the tag of the collection.  Of course the current core schema does not have this problem, as it never applies rule (2), nor does it apply rule (3) to collections.  But it seems that any schema that did both of these would need to be written carefully to avoid potentially subtle circular dependencies.  Is this considered a problem for the schema authors rather than for the YAML spec itself?

Thanks for any clarifications.

Regards and happy new year,
Geoff Adams


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox


_______________________________________________
Yaml-core mailing list
Yaml-core@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/yaml-core