when the keys are not unique: mapping and merging

Andrey Somov <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <CAEO54bEsria59a=24N28HnDaS2tfG6twRMe2WPPBWL3_0W9G0g@mail.gmail.com>
Hi all,
SnakeYAML (YAML 1.1 for Java) recently got an issue. I think this
topic is not clearly specified and I would like to get some
clarification.

The issue is here: http://code.google.com/p/snakeyaml/issues/detail?id=139

It is about the Merge Key Language-Independent Type
(http://yaml.org/type/merge.html)
When the keys are not unique in a normal mapping, then the last value
wins for all the current YAML implementations.
But the merge tag has the following definition:
"If the value associated with the key is a single mapping node, each
of its key/value pairs is inserted into the current mapping,
unless the key already exists in it. "

It means that for the merge tag the second value for the same key does
not override the value.

It looks like some parsers (libyaml ?) ignore this requirement, but
some parsers try to respect it, which causes misunderstanding.

What is the preferred way to deal with not unique keys for the merge tag ?

Andrey
SnakeYAML developer

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.