Brian just asked the question on the list if alias
nodes can have types. The answer is no. An alias
node is a figment of the serialization model only.
When loaded into the random access model it is
*replaced* with the node that has the same anchor.
Thus, we need to update the productions to forbid
a !class on the *alias node.
Clark
On Sun, Nov 11, 2001 at 06:02:09PM -0500, Clark C . Evans wrote:
| Also, the producion should be ammended to not allow
| an anchor attribute on the same line as an alias node.
|
| Since...
|
| $a = ['val']
| $b = $a
| $c = $b
| $d = [$a,$b,$c]
|
| is the same as...
|
| $a = ['val']
| $b = $a
| $c = $a
| $d = [$a,$b,$c]
|
| We know that...
|
| - &001
| - val
| - &002 *001
| - *002
|
| is the same as...
|
| - &001
| - val
| - *001
| - *001
|
| Thus... we can soundly forbid anchor attributes
| on an alias node.
|
|
| Clark
|
| On Sun, Nov 11, 2001 at 05:50:01PM -0500, Clark C . Evans wrote:
| | On Sun, Nov 11, 2001 at 01:46:40PM -0800, Brian Ingerson wrote:
| | | On 11/11/01 10:39 -0500, Clark C . Evans wrote:
| | | > On Sun, Nov 11, 2001 at 12:11:22PM +0200, Oren Ben-Kiki wrote:
| | | > |
| | | > | As for his concern about anchors and types messing up the
| | | > | information model. I beg to differ.
| | | > |
| | | > | Type: Perl/Python/Java/SmallTalk/Lisp/JavaScript/C++ all have at least
| | | > | *some* notion of run time type information. C doesn't, and indeed when
| | | > | loading a YAML file into C you *must* encode the type info somehow.
| | | >
| | | > I'm not concerned about types. I'm concerned about
| | | > the anchors. Do we have a tree /w anchors or a graph?
| | |
| | | I think I agree with Oren that almost all languages support
| | | anchors, and you could use a map wrapper to round-trip through
| | | those that don't.
| |
| | We have *two* information models; one is our "native" or
| | "random access" model, and the other is our "serialization"
| | "sequential access" model. The August specification made
| | a distinction between the two, and I think we need to move
| | back to this distinction.
| |
| | Random Access:
| |
| | - Our model is a "graph", in other words, a node may have
| | multiple "incoming arrows" or "parents".
| |
| | - Alias nodes and anchors are not part of this model;
| | you can't ask for the node's anchor, and there is
| | no such thing as an alias node.
| |
| | - Kinds of nodes are: scalar, map, sequence.
| |
| | - Each node has a "class".
| |
| |
| | Sequential Access:
| |
| | - Our model is a "tree". In other words, each node has
| | exactly one parent.
| |
| | - To record random access links, we use a special kind
| | of node (alias) and we attach a special chunk of data
| | to each node (anchor).
| |
| | - Kinds of nodes are: scalar, map, sequence, and alias.
| |
| | - Each node has a "class" and an "anchor".
| |
| |
| | To convert from random to sequential access, the first time
| | a node is encountered, it is serialized and given an anchor.
| | Subsequent occurances of the node is replaced with an anchor
| | having the same anchor value as the sequential copy of the node.
| | To convert from sequential to random access, each time an
| | anchor node is encountered, it is replaced with the node
| | having an anchor of the same number.
| |
| | What I'd like is for the specification to once again split
| | these two models... beacuse they *are* very different. This
| | is my primary issue. In particular, "anchor" is *not* an
| | implicit type. It is very special and must be treated as
| | such. It is not reported in the random access model.
| |
| | ...
| |
| | Now, that said, I was playing with a small altercation of the
| | information model such that our "branch" nodes were map nodes.
| | This is kinda neet. It allows us to make the differnce between
| | "branch" and "scalar" nodes; instead of "sequence", "map" and
| | "scalar" nodes. What's neat, is that sequence can be made
| | into a type... a special case where the keys of the map are
| | integers.
| |
| |
| | | foo: &001 bar
| | |
| | | can be
| | |
| | | foo:
| | | &: 001
| | | =: bar
| |
| | I don't think we should speculate how a language which
| | doesn't support aliases (such as C) would do this. I think
| | that it's up to the C implementation; or, the C implementation
| | may only deal with YAML via the sequential model.
| |
| | Best,
| |
| | Clark
| |
| | _______________________________________________
| | Yaml-core mailing list
| | Yaml-core@...
| | https://lists.sourceforge.net/lists/listinfo/yaml-core
|
| --
| Clark C. Evans Axista, Inc.
| http:\\axista.com 800.926.5525
| Collaborative Software for Project Management
|
| Patriotisim means protecting core values during difficult times,
| not pasting a flag on your SUV and repealing the Bill of Rights.
|
| _______________________________________________
| Yaml-core mailing list
| Yaml-core@...
| https://lists.sourceforge.net/lists/listinfo/yaml-core
--
Clark C. Evans Axista, Inc.
http:\\axista.com 800.926.5525
Collaborative Software for Project Management
Patriotisim means protecting core values during difficult times,
not pasting a flag on your SUV and repealing the Bill of Rights.
|